Git Product home page Git Product logo

elm-analyse's People

Contributors

adeschamps avatar andys8 avatar antew avatar arowm avatar brandly avatar carlthuringer avatar eeue56 avatar felixlam avatar ferhtgoldaraz avatar gollerob avatar jinjor avatar methodgrab avatar pacbeckh avatar razzeee avatar ream88 avatar rlopzc avatar rofrol avatar stefanjanse avatar stil4m avatar turbomack avatar xtian avatar zwilias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elm-analyse's Issues

Improve module graph analyser

Work on a graph analyser has been started in #39.

The next steps will be:

  • Add (interactive) visualisation in web UI (I would keep the code export as this allows users to include this in readmes, etc.)
  • Add more information about the modules to the graph
  • Further down the road: Add more exports such as Netjson.org

Relevance of NoUncurriedPrefix

The NoUncurriedPrefix checks if binary operators are used in prefix notation instead of infix notation. For example: (+) 1 2 instead of 1 + 2.

Sometimes using operator prefix notation is more convenient.

To construct tuples (@manuscrypt):

[ (,) "color" "red" ]

Or for elm-css:

(.) MyClass
    [ ...
    ]

The point is:
Should this check be dropped, become less strict, highly configurable or something else?
Suggestions are welcome :)

Crash on missing `source-directories`

The program crashes when source-directories refer to a folder that not exists.

Should the program crash, or should it just ignore the folder with a warning?

Cached sources interfere with code completion in elmjutsu

When loading all files these appear to be cached in elm-stuff/elm-analyse/ and in particular in elm-stuff/elm-analyse/_shas. This duplicates the source files, which confuses the popular Atom plugin elmjutsu. Maybe we can find a way to store the cache outside of the source folder (e.g. in /tmp or ~/.elm-analyse).

This issue manifests itself most prominently when also using the hyper click plugin.

"Unused imported variable": Destructured Single Type Union in let-statement

Unused imported variable Zipper in file "src/elm/View/Survey.elm" at ((4,35),(4,41))

mbaumann [22:41]
@stil4m: i am using your tool on my most recent project and i am trying to get all the messages out, but I am having this case where I am not sure how to handle or if it's an issue:

i tried many variants. my last import looked like this:
import List.Zipper exposing (Zipper(Zipper))

with a statement like this:

let (Zipper prev cur next) =  model.thing
in ... 

gives me:

Unused imported variable `Zipper` in file "src/elm/View/Survey.elm" at ((4,35),(4,41))

Apply fix does not work on Windows

(node:8144) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Trying to send an unexpected type of value through port onFileContentWithShas:
Expecting a String at _[0][0] but instead got: null

Allow configuration for excluded paths

It would be nice to be able to exclude certain paths. E.g. I would like to exclude the "elm-stuff" directory as well as our "vendor" directory as this includes code that is not 100% under our control.

Ideally this could be done via the elm-analyse.json. E.g.:

{
    "checks": {
        "LineLengthExceeded" : false
    },
    "excludedPaths": [ "elm-stuff", "vendor" ]
}

Prepare 0.1.0 release

Things to do:

  • Implement --help command line option
  • Document configuration options (elm-analyse.json)
  • Test on Windows
  • Create CHANGELOG

Can't install elm-analyse on Linux

I wanted to try out elm-analyse, but unfortunately I have trouble with installation. It seems that the script can't find elm-format-download (whatever that thing is...)
I'm on Linux Mint 18

node 7.2.1
elm 18.0
elm-format 0.5.2-alpha

This is the error I get trying to run yarn add

error /home/jacek/node_modules/elm-analyse: Command failed.
Exit code: 127
Command: sh
Arguments: -c ./node_modules/.bin/elm-format-download -t ./node_modules/.bin
Directory: /home/jacek/node_modules/elm-analyse
Output:
sh: 1: ./node_modules/.bin/elm-format-download: not found

and here is error part from npm-debug.log when I run (sudo) npm add -g elm-analyse

38875 verbose stack Error: [email protected] postinstall: `elm-format-download -t ./node_modules/.bin`
38875 verbose stack spawn ENOENT
38875 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:33:16)
38875 verbose stack     at emitTwo (events.js:106:13)
38875 verbose stack     at ChildProcess.emit (events.js:191:7)
38875 verbose stack     at maybeClose (internal/child_process.js:885:16)
38875 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
38876 verbose pkgid [email protected]
38877 verbose cwd /home/jacek/bin
38878 error Linux 4.4.0-21-generic
38879 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "elm-analyse"
38880 error node v7.2.1
38881 error npm  v3.10.10
38882 error file sh
38883 error code ELIFECYCLE
38884 error errno ENOENT
38885 error syscall spawn
38886 error [email protected] postinstall: `elm-format-download -t ./node_modules/.bin`
38886 error spawn ENOENT
38887 error Failed at the [email protected] postinstall script 'elm-format-download -t ./node_modules/.bin'.
38887 error Make sure you have the latest version of node.js and npm installed.
38887 error If you do, this is most likely a problem with the elm-analyse package,
38887 error not with npm itself.
38887 error Tell the author that this fails on your system:
38887 error     elm-format-download -t ./node_modules/.bin
38887 error You can get information on how to open an issue for this project with:
38887 error     npm bugs elm-analyse
38887 error Or if that isn't available, you can get their info via:
38887 error     npm owner ls elm-analyse
38887 error There is likely additional logging output above.

Parsing error with empty list + multiline comment

I commented out some attributes and ran into parsing error on this syntax

view =
    div [{- I commented some stuff out -}] []
Could not load file "View.elm" due to: Could not continue parsing on location (21,7)

Looks like this only happens for empty list, because lists like [1, 2 {- comment -}] and [{- comment -} 1, 2] work fine (inline comment is OK too)

Unnecessary params and negative numbers

This is a tiny nitpick, but it seems that unnecessary params around a number/expression/constant with negation sign are not reported.

Reporting unnecessary params:

(toFloat 5) / 2
(toFloat (3 + 3)) / 2
(toFloat width) / 2

Same thing here, but not reported:

(toFloat -5) / 2
(toFloat -(3 + 3)) / 2
(toFloat -width) / 2

Functions defined in let bindings

let are commonly used to hold intermediate values that are used (multiple times) in other expressions in the let binding.

There is no reason to have functions in there, extracting these to top-levels would be a better choice. Encapsulation can be achieved by not exposing that extracted function or by creating a whole new module.

Exit with error code when encountering issues

Right now elm-analyse always exits with status 0.

This makes it more difficult to run it in a CI setting where we want to mark a build as unstable for certain conditions.

It would be nice if the exit code was only 0 for runs without encountering any issues.

At a minimum it should be non-zero when encountering issues. Nice to have would be a configurable threshold for "unstable"/"failed". We could then exit with status code 1 if any issues were encountered and status code 2 if the threshold it exceeded.

Add cache buster to UI sources

This is required to make sure that the frontend code does not mismatch the backend code (especially for decoders).

Thanks to @mbuscemi for reporting this via slack

Add more auto-fixes

This is an overarching ticket for auto fixes that can be implemented:

  • UseConsOverConcat
  • DropConcatOfLists
  • DropConsOfItemAndList
  • DuplicateImports
  • NoDebugStatements
  • NoUnurriedPrefix
  • UnusedImports (#23)
  • UnusedTypeAlias (#31)
  • MultiLineRecordFormatting (#91)

Ignore elm source files in directories with starting with lower case.

For example with the following source-directories:

"source-directories" : [
  "."
]

And you have the following file structure:

elm-package.json
Main.elm
tests/MainTest.elm
tests/elm-package.json

Then tests/MainTest.elm should be ignored when analysing the elm-package.json in the root.

More checks

  • Exceeded line length
  • Unnecessary List.concat when concatenating only fixed size lists.
  • Record type aliases should be formatted multiline when exceeding N fields. (#24)
  • Functions where 'too much' happens.
  • Function should be moved to another module for better encapsulation.
  • Undocumented function that is exposed by module.
  • Use alias for complex 'thing'. This can be done by inspecting signatures.
  • Use point free notation where possible (\_ -> b to always b and \x -> List.map f x to List.map f)
  • Determine untested code.
  • Use multiline string instead of concatenated single line string.
  • Use list concatenation instead of multiple ++.
  • Replace function with a function provided by elm-lang/* or elm-community/*.
  • Magic numbers.
  • Check for unnecessary port modules (#45)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.