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

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

Merged
merged 2 commits into from
Nov 17, 2022

Conversation

Sorokin-Anton
Copy link
Contributor

@Sorokin-Anton Sorokin-Anton commented Nov 2, 2022

Description

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.

Also add CLI option 1--include-untracked` to treat such files as existing.

Related issue(s)

Fixes #200

✅ Checklist for your Pull Request

Ideally a PR has all of the checkmarks set.

If something in this list is irrelevant to your PR, you should still set this
checkmark indicating that you are sure it is dealt with (be that by irrelevance).

Related changes (conditional)

  • Tests

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from
      silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
  • Public contracts

    • Any modifications of public contracts comply with the Evolution
      of Public Contracts
      policy.
    • I added an entry to the changelog if my changes are visible to the users
      and
    • provided a migration guide for breaking changes if possible

Stylistic guide (mandatory)

@Sorokin-Anton Sorokin-Anton force-pushed the Sorokin-Anton/#208-remove-exessive-newlines branch 2 times, most recently from 860c847 to 1476bd3 Compare November 4, 2022 12:27
@dcastro dcastro requested a review from Martoon-00 November 4, 2022 15:20
Base automatically changed from Sorokin-Anton/#208-remove-exessive-newlines to master November 4, 2022 15:41
Copy link
Member

@Martoon-00 Martoon-00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks very good to me 👍

I would like to take another look after rebase.

location =
if root `equalFilePath` "."
then ""
else dropTrailingPathSeparator root
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After all, getUntrackedFiled half-duplicates readDirectoryWith, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed code duplication in last commit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this regard, do you plan to retain the last commit or squash it afterward?

I like how it is put separately, but it contains a lot of changes to the first commit and this is not good.

Copy link
Contributor Author

@Sorokin-Anton Sorokin-Anton Nov 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to retain it, but now see problem you mentioned, so I will better move some changes between commits during interactive rebase (I'll write here when done)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, will wait for your message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good 👍

@Martoon-00
Copy link
Member

Also, as we discussed in Slack, let's add an option (probably a command line option?) to treat untracked git files as already added. FTR, my use case is sanity-checking auto-generated markdown documentation which we have in Morley.

@Sorokin-Anton Sorokin-Anton force-pushed the Sorokin-Anton/#200-untracked-files-hints branch from e46f4a8 to 6ad13ae Compare November 10, 2022 14:55
@Sorokin-Anton
Copy link
Contributor Author

Sorokin-Anton commented Nov 10, 2022

Also, as we discussed in Slack, let's add an option (probably a command line option?) to treat untracked git files as already added. FTR, my use case is sanity-checking auto-generated markdown documentation which we have in Morley.

Done, also rebased on master

Copy link
Member

@Martoon-00 Martoon-00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good to me 👍

I have mostly cosmetic concerns, and likely that will be it.

src/Xrefcheck/Core.hs Outdated Show resolved Hide resolved
@Martoon-00
Copy link
Member

Oh and just in case (I wanted to mention this, but didn't expect you to read my messages close to Sunday's midnight 😅): this all is absolutely fine to fix some later (Monday/Tuesday), no hurry is needed. Unless you have a wish and opportinity to work on it right now 🙂

@Sorokin-Anton
Copy link
Contributor Author

Of course, I am just checking github notifications to understand choices of tasks for tomorrow

@Sorokin-Anton Sorokin-Anton force-pushed the Sorokin-Anton/#200-untracked-files-hints branch from 02967fe to 24c3bd9 Compare November 15, 2022 22:53
@Martoon-00
Copy link
Member

In the second commit, you seem to have no subject, it immediately starts from the description. Probably this accidentally happened during rebase?

Aside from that, LGTM.

Copy link
Member

@Martoon-00 Martoon-00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last nitpick from my side remains, but I preliminarily approve, feel free to merge after fixing that.

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.
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 Sorokin-Anton force-pushed the Sorokin-Anton/#200-untracked-files-hints branch from 24c3bd9 to 1c0fbfe Compare November 17, 2022 13:38
@Sorokin-Anton Sorokin-Anton merged commit 68a9098 into master Nov 17, 2022
@Sorokin-Anton Sorokin-Anton deleted the Sorokin-Anton/#200-untracked-files-hints branch December 1, 2022 12:01
@int-index int-index mentioned this pull request Dec 27, 2024
5 tasks
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 this pull request may close these issues.

Warnings about files that weren't added to git yet
2 participants