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

Augment a given project's :acceptable-aliases-whitelist with the aliases it already uses #205

Merged
merged 7 commits into from
Apr 20, 2022

Conversation

vemv
Copy link
Contributor

@vemv vemv commented Mar 8, 2022

Brief

Fixes #204. The tldr is:

A given project's :acceptable-aliases-whitelist is augmented with the set of aliases that are used in the project and not new (per git: they don't belong to the git status or the git branch diff)

Needs refactor-nrepl latest (see) but degrades gracefully.

QA plan

  • Use f-s in a project that wasn't conforming to f-s' ns aliasing suggestions
  • Observe that existing aliases, even if non-conforming, will be fine
  • non-conforming new aliases will cause a linting fault.

This can be further verified by inspecting the formatting-stack.defaults/default-linters object, which will have a larger :acceptable-aliases-whitelist map.

Author checklist

  • I have QAed the functionality
  • The PR has a reasonably reviewable size and a meaningful commit history
  • I have run the branch formatter and observed no new/significative warnings
  • The build passes
  • I have self-reviewed the PR prior to assignment
  • Additionally, I have code-reviewed iteratively the PR considering the following aspects in isolation:
    • Correctness
    • Robustness (red paths, failure handling etc)
    • Test coverage
    • Spec coverage
    • Documentation
    • Security
    • Performance
    • Breaking API changes
    • Cross-compatibility (Clojure/ClojureScript)

Reviewer checklist

  • I have checked out this branch and reviewed it locally, running it
  • I have QAed the functionality
  • I have reviewed the PR
  • Additionally, I have code-reviewed iteratively the PR considering the following aspects in isolation:
    • Correctness
    • Robustness (red paths, failure handling etc)
    • Test coverage
    • Spec coverage
    • Documentation
    • Security
    • Performance
    • Breaking API changes
    • Cross-compatibility (Clojure/ClojureScript)

@vemv vemv changed the title Augment given project's :acceptable-aliases-whitelist with the aliases it already uses Augment a given project's :acceptable-aliases-whitelist with the aliases it already uses Mar 9, 2022
@vemv vemv marked this pull request as ready for review March 9, 2022 01:23
@vemv
Copy link
Contributor Author

vemv commented Mar 15, 2022

Bumped refactor-nrepl again, which now has :as-alias support for clj 1.11.

Copy link
Member

@thumbnail thumbnail left a comment

Choose a reason for hiding this comment

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

Thanks for this one 🚀

Some minor comments, addressable at your own discretion

src/formatting_stack/linters/ns_aliases/impl.clj Outdated Show resolved Hide resolved
src/formatting_stack/linters/ns_aliases/impl.clj Outdated Show resolved Hide resolved
src/formatting_stack/strategies.clj Outdated Show resolved Hide resolved
test/functional/formatting_stack/linters/ns_aliases.clj Outdated Show resolved Hide resolved
{} {'a ['b]} {'a ['b]}
{'a ['b]} {'a ['c]} {'a (matchers/in-any-order ['b 'c])}
{'a ['b]} {'a ['b]} {'a ['b]}
{'a ['b 'c] 'd ['e 'f]} {'a ['g 'h] 'd ['i 'j]} {'a (matchers/in-any-order ['b 'c 'g 'h])
Copy link
Member

Choose a reason for hiding this comment

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

I suppose we could've quoted the enitre maps too insetad of every symbol; but this works too 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I don't like that one can turn {'a into '{a opportunistically.

An homogeneous pattern is simpler to compare visually/cognitively, else it might not be clear that you're comparing stuff of the same kind

src/formatting_stack/linters/ns_aliases/impl.clj Outdated Show resolved Hide resolved
src/formatting_stack/strategies.clj Show resolved Hide resolved
src/formatting_stack/linters/ns_aliases/impl.clj Outdated Show resolved Hide resolved
@vemv
Copy link
Contributor Author

vemv commented Mar 19, 2022

Cheers ☕️☕️

@vemv
Copy link
Contributor Author

vemv commented Apr 15, 2022

Ready again!

@thumbnail thumbnail merged commit e37e22b into nedap:main Apr 20, 2022
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.

Make :formatting-stack/ns-aliases understand a codebase's patterns
2 participants