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

linter reporting #109

Closed
wants to merge 52 commits into from
Closed

linter reporting #109

wants to merge 52 commits into from

Conversation

thumbnail
Copy link
Member

@thumbnail thumbnail commented Jan 19, 2020

Brief

In a quest to make f-s more adoptable / easier to understand:
image

Adds an intermediate format for linters to allow more control over reporting. If this is acceptable I'll progress with formatters and process!

related #64, #48

TODO

  • document format (specs)
  • formatting
  • All return-values are considered errors, if :type is added we can handle exceptions and suggestions/warnings as well.
    • Currently called ':level' but :type seems better due to different contents of the maps
  • merge Use kondo api #102 + rebase this

QA plan

nothing yet

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)
    • Modular design
    • 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)
    • Modular design
    • Test coverage
    • Spec coverage
    • Documentation
    • Security
    • Performance
    • Breaking API changes
    • Cross-compatibility (Clojure/ClojureScript)

This was referenced Jan 19, 2020
@vemv
Copy link
Contributor

vemv commented Feb 7, 2020

Rebased against master

@vemv vemv changed the base branch from 91-kondo-api to master February 7, 2020 10:15
@vemv
Copy link
Contributor

vemv commented Feb 8, 2020

FYI I think it was a good mistake from my side to rebase this against master :)

I'll review the Kondo+Reporters stuff at the same time, improving things directly where possible.

We've kept this in the oven for far too long now - this weekend I think I can just be done w/ it

Copy link
Contributor

@vemv vemv left a comment

Choose a reason for hiding this comment

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

Gave Reporters and Kondo some QAing. Working beautifully - kudos!

I noticed that reporting can easily not fit into a REPL. Were you aware of the issue?

image

src/formatting_stack/util.clj Show resolved Hide resolved
src/formatting_stack/processors/kondo.clj Outdated Show resolved Hide resolved
src/formatting_stack/project_parsing.clj Outdated Show resolved Hide resolved
src/formatting_stack/protocols/spec.clj Outdated Show resolved Hide resolved
src/formatting_stack/reporters/file_writer.clj Outdated Show resolved Hide resolved
src/formatting_stack/linters/kondo.clj Outdated Show resolved Hide resolved
src/formatting_stack/protocols/reporter.clj Outdated Show resolved Hide resolved
@vemv vemv force-pushed the reporting branch 2 times, most recently from f8557d8 to 65cd85c Compare February 8, 2020 04:20
@vemv
Copy link
Contributor

vemv commented Feb 8, 2020

The Kondo cache part looks correct - enabled now.

QAd in JVM clj so far - lgtm: I can trigger a Kondo warning (e.g. :refer all) and then have it fixed.

This proves that a cached version of a given ns doesn't interfere with a fresh analysis of that same ns.

@vemv
Copy link
Contributor

vemv commented Feb 8, 2020

I noticed that reporting can easily not fit into a REPL. Were you aware of the issue?

A simple measure might be to rearrange columns:

[level, message, source] -> [level, source, message]

@vemv vemv mentioned this pull request Feb 8, 2020
28 tasks
vemv added 25 commits February 11, 2020 01:59
(At least for the time being) `formatting-stack.linters.kondo` already has logic for separating clj from cljs options.
It's the first publicly-available release.
Said linter can very easily trigger a lot of false positives.
* Prefer truncation to padding
* Use a hierarchical format
* Prefer coloring to icons
* Make coloring optional
  * (far simpler than detecting tty capabilities, from what I could research)
* Within a given file report, group the reports by `:source`

Accordingly, `reporters.printer` has been discarded.
This trades some eagerness, in exchange for a faster first run of kondo.
By making the emitted :column/:line info more variable, users can get an idea of how greatly was a given limit surpassed.
A callback passed to `process-in-parallel!` shouldn't return a lazy computation, since that would make the parallel machinery useless (a lazy computation is expressed in parallel, but it's only realised later, in a non-parallel context).
The idea is to place linters with a best usefuleness/speed ratio first.
This allows restoring `ensure-coll` its old semantics, preventing complexities.
Now it can handle files containing invalid syntax.

There was a previous attempt of this, but too coarse-grained.
It would be anomalous that Eastwood hit a syntactically broken anyway - it could indicate room for improvement in strategies/etc.
@vemv
Copy link
Contributor

vemv commented Feb 11, 2020

#116

@vemv vemv closed this Feb 11, 2020
@vemv vemv deleted the reporting branch February 11, 2020 01:22
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.

2 participants