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

Remove unnecessary requires #391

Merged
merged 3 commits into from
May 15, 2023
Merged

Remove unnecessary requires #391

merged 3 commits into from
May 15, 2023

Conversation

alysbrooks
Copy link
Member

Added some comments about some edge cases.

Unnecessary requires aren't a major issue, but there are advantages to cleaning them up. This PR silences some warnings from clj-kondo, makes the namespaces easier to understand, and may avoid some circular imports in the future.

@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

Patch coverage has no change and project coverage change: +3.13 🎉

Comparison is base (846248f) 71.42% compared to head (0b3c4b6) 74.56%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #391      +/-   ##
==========================================
+ Coverage   71.42%   74.56%   +3.13%     
==========================================
  Files          52       52              
  Lines        2800     2799       -1     
  Branches      257      283      +26     
==========================================
+ Hits         2000     2087      +87     
+ Misses        628      522     -106     
- Partials      172      190      +18     
Flag Coverage Δ
integration 53.59% <ø> (+2.73%) ⬆️
unit 69.45% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/kaocha/api.clj 74.74% <ø> (ø)
src/kaocha/assertions.clj 42.85% <ø> (ø)
src/kaocha/load.clj 69.69% <ø> (ø)
src/kaocha/matcher_combinators.clj 25.00% <ø> (ø)
src/kaocha/monkey_patch.clj 83.01% <ø> (ø)
src/kaocha/ns.clj 100.00% <ø> (ø)
src/kaocha/plugin/capture_output.cljc 100.00% <ø> (+3.12%) ⬆️
src/kaocha/plugin/filter.clj 87.50% <ø> (-0.90%) ⬇️
src/kaocha/repl.clj 37.03% <ø> (ø)
src/kaocha/runner.clj 45.00% <ø> (ø)
... and 5 more

... and 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -15,7 +15,7 @@
[kaocha.output :as output]
[kaocha.plugin :as plugin]
[kaocha.result :as result]
[kaocha.specs :as specs]
#_[kaocha.specs :as specs] ;; required for some reason?
Copy link
Contributor

@borkdude borkdude Feb 3, 2023

Choose a reason for hiding this comment

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

If you require namespaces for side effects, you can leave out the alias and clj-kondo won't report it as unused.

Copy link
Member

Choose a reason for hiding this comment

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

When namespaces are required for side-effects, the convention we use is to (require '...) them below the ns form.

Copy link
Contributor

@borkdude borkdude Mar 30, 2023

Choose a reason for hiding this comment

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

This also works (both for clj-kondo and JVM)

@alysbrooks alysbrooks force-pushed the alys/remove-unused branch 2 times, most recently from 9b759b3 to 3a518d1 Compare March 9, 2023 05:38
@alysbrooks
Copy link
Member Author

This seems slightly more prone to breaking things not covered by tests, so I figure we should wait until #413 is merged.

Added some comments about some edge cases.

Unnecessary requires aren't a major issue, but there are advantages to
cleaning them up. This PR silences some warnings from clj-kondo, makes
the namespaces easier to understand, and may avoid some circular imports
in the future.
Remove an :as to silence clj-kondo warning.

Apparently kaocha.specs was added accidentally to kaocha.runner
while sorting the imports.
@alysbrooks alysbrooks force-pushed the alys/remove-unused branch from 048dd48 to 0b3c4b6 Compare May 15, 2023 18:49
@alysbrooks alysbrooks merged commit f8775f2 into main May 15, 2023
@alysbrooks
Copy link
Member Author

Released in v1.84.1335

[lambdaisland/kaocha "1.84.1335"]                 ;; deps.edn
{lambdaisland/kaocha {:mvn/version "1.84.1335"}}  ;; project.clj

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.

3 participants