Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings about files that weren't added to git yet #200

Closed
Sorokin-Anton opened this issue Oct 21, 2022 · 1 comment · Fixed by #215
Closed

Warnings about files that weren't added to git yet #200

Sorokin-Anton opened this issue Oct 21, 2022 · 1 comment · Fixed by #215
Assignees
Milestone

Comments

@Sorokin-Anton
Copy link
Contributor

Clarification and motivation

After #174, only files that were added to git exist for us. Somebody can make a new file and run xrefcheck before adding it to git (for example I add files right before commiting). List of those files can be obtained, for example, via git ls-files --others --exclude-standard. There is two problems for this user:

  • Link in those new files are not checked
  • If a link in an added to git file references such new file, it is reported as broken

I think this should be our behavior:

  • If a scannable (currently it means markdown) file is not yet tracked by git, we'll emit a warning saying references from that file will not be checked.
  • If there is a link to such file, we'll change the message of the existing error from "file doesn't exist" to "file exists, but is not yet tracked by git"

IMHO we can also change error to warning in second case, maybe make some CLI/config options (e.g. for simply threating such files as existent)

Acceptance criteria

If a user runs xrefcheck before git add, we are not silently skipping new files, and we're not reporting links to them as links to unexisting files

@Sorokin-Anton Sorokin-Anton added this to the 0.3.0 milestone Oct 21, 2022
@dcastro
Copy link
Member

dcastro commented Oct 21, 2022

IMHO we can also change error to warning in second case, maybe make some CLI/config options (e.g. for simply threating such files as existent)

We probably should not have a config option for this. This scenario should only happen locally, and the config file is meant to be committed and used by the CI.

For this same reason, I don't think it matters much if we change it from an "error" to a "warning". In practice, this means xrefcheck would terminate with the exit code 0 instead of non-0. But the exit code isn't all that useful when the program is being run by a human (which is likely to be the case when xrefcheck is run locally).

@Sorokin-Anton Sorokin-Anton self-assigned this Nov 1, 2022
Sorokin-Anton added a commit that referenced this issue Nov 2, 2022
Problem: after 0.2.2 release, xrefcheck cares only about files
that were added to Git. That can be confusing for users (see #200)

Solution:
If a scannable (currently it means markdown) file is not ignored
(by git or via config) and not tracked by git, print a warning to
stderr while scanning repo.

If a link target such file, change error message from "file not exists"
to `Link target is not tracked by Git`

Suggest user to run "git add" before running xrefcheck in both cases.

To do this, I've changed the `RepoInfo` type, so it also contains
information about untracked files now.
Sorokin-Anton added a commit that referenced this issue Nov 10, 2022
Problem: after 0.2.2 release, xrefcheck cares only about files
that were added to Git. That can be confusing for users (see #200)

Solution:
If a scannable (currently it means markdown) file is not ignored
(by git or via config) and not tracked by git, print a warning to
stderr while scanning repo.

If a link target such file, change error message from "file not exists"
to `Link target is not tracked by Git`

Suggest user to run "git add" before running xrefcheck in both cases.

To do this, I've changed the `RepoInfo` type, so it also contains
information about untracked files now.
Sorokin-Anton added a commit that referenced this issue Nov 10, 2022
Problem: xrefcheck checks only files that are tracked by Git,
but sometimes we want to run xrefcheck on
files without adding them to Git, e.g. when we want to
test some generator of markdown files or when we actively
create markdown files during development.

Solution: add option to threat files that were neither
added to git nor ignored as existing.
Sorokin-Anton added a commit that referenced this issue Nov 15, 2022
Problem: after 0.2.2 release, xrefcheck cares only about files
that were added to Git. That can be confusing for users (see #200)

Solution:
If a scannable (currently it means markdown) file is not ignored
(by git or via config) and not tracked by git, print a warning to
stderr while scanning repo.

If a link target such file, change error message from "file not exists"
to `Link target is not tracked by Git`

Suggest user to run "git add" before running xrefcheck in both cases.

To do this, I've changed the `RepoInfo` type, so it also contains
information about untracked files now.
Sorokin-Anton added a commit that referenced this issue Nov 17, 2022
Problem: after 0.2.2 release, xrefcheck cares only about files
that were added to Git. That can be confusing for users (see #200)

Solution:
If a scannable (currently it means markdown) file is not ignored
(by git or via config) and not tracked by git, print a warning to
stderr while scanning repo.

If a link target such file, change error message from "file not exists"
to `Link target is not tracked by Git`

Suggest user to run "git add" before running xrefcheck in both cases.

To do this, I've changed the `RepoInfo` type, so it also contains
information about untracked files now.
Sorokin-Anton added a commit that referenced this issue Nov 17, 2022
Problem: xrefcheck checks only files that are tracked by Git,
but sometimes we want to run xrefcheck on
files without adding them to Git, e.g. when we want to
test some generator of markdown files or when we actively
create markdown files during development.

Solution: add option to treat files that were neither
added to git nor ignored as existing.
Sorokin-Anton added a commit that referenced this issue Nov 17, 2022
…les-hints

[#200] Warnings about files that weren't added to git yet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants