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

[Feature Suggestion] Allow disabling analytics rules and ignoring directories #606

Open
emilgoldsmith opened this issue Jun 10, 2021 · 9 comments

Comments

@emilgoldsmith
Copy link

Expected Behavior

Hi! Thank you so much to all the contributors for the work you do! I may be able to contribute to this change in the future, though not right now, but just wanted to log this feature suggestion now.

My specific needs stem from:

  • Wanting to disable the single field record analytics rule as I think it can add a lot of important context to have a named argument in many circumstances, but I don't want to fully disable the analytics as then I for example lose the unused imports greying out in the editor etc.
  • Wanting to ignore .elm-spa/generated which Elm SPA automatically generates so I don't have problems with missing type annotations showing up in my VSCode Problems tab

Current Behavior

Right now I can only enable or disable all analytics rules at once and only for all files in my repo

Possible Solution

Think it's obvious from above :), for "related work" Elm Analytics has these features so maybe code / implementation strategies could be borrowed from there

@razzeee
Copy link
Member

razzeee commented Jun 10, 2021 via email

@emilgoldsmith
Copy link
Author

emilgoldsmith commented Jun 10, 2021 via email

@razzeee
Copy link
Member

razzeee commented Jun 10, 2021 via email

@emilgoldsmith
Copy link
Author

emilgoldsmith commented Jun 10, 2021 via email

@razzeee
Copy link
Member

razzeee commented Jun 11, 2021

Can you setup an example repo where this reproduces? It's really hard to see why this fails otherwise.

@emilgoldsmith
Copy link
Author

emilgoldsmith commented Jun 12, 2021 via email

@hanshenrik
Copy link

I'm also interested in this. We have an elm-analyse.json file that looks like this:

{
    "checks": {
        "ExposeAll": false,
        "ImportAll": false,
        "SingleFieldRecord": false,
        "TriggerWords": false,
        "UseConsOverConcat": false,
        "UnnecessaryParens": false
    },
    "excludedPaths": [
        "generated_api_src"
    ]
}

The plugin works fine up until version 1.5.3, but for versions 2.0.0 and above I get a bunch of errors listed in the Problems tab in VSCode. I guess this is because it no longer ignores the folders listed in excludedPaths. Do you see anything wrong with the elm-analyse.json that should cause this?

@razzeee
Copy link
Member

razzeee commented Jul 2, 2021

No, in fact I just setup a test repo with that config and was able to confirm, that excludedPaths work on Linux with the latest release.

@hanshenrik
Copy link

Thanks for the quick response. I figured out what my problem was (not really related to this issue, but perhaps useful nonetheless): Turned out I had an old elm-format version install globally (v0.8.2). We also have a version installed locally in the project (v0.8.5). Since we have a monorepo, the binary is not located at node_modules/elm-format/bin, but rather at frontend/node_modules/elm-format/bin. I guess this was the issue, since the "Elm LS: Elm Format Path" config option says it should look for local versions first if its left empty. So I had to change this to frontend/node_modules/elm-format/bin, and now the errors are gone :)

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

No branches or pull requests

3 participants