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

Solium lints incorrectly on windows. #162

Closed
tsuberim opened this issue Jan 3, 2018 · 7 comments
Closed

Solium lints incorrectly on windows. #162

tsuberim opened this issue Jan 3, 2018 · 7 comments

Comments

@tsuberim
Copy link

tsuberim commented Jan 3, 2018

Running yarn solium on windows 10 and on a docker container with Ubuntu installed yields very different results.

Reproduce:
$ git clone https://github.com/daostack/daostack.git
$ cd daostack
$ yarn
$ yarn solium

On windows: 47 errors, 205 warnings found.
On Ubuntu: only 5 warns

@duaraghav8
Copy link
Owner

Could you please produce the following for both win & ubuntu:

  • Command used to lint your file(s) (or whether you're using solium as an IDE extension)
  • .soliumrc.json & .soliumignore
  • Solium version (solium -V)
  • screenshot of outputs

@tsuberim
Copy link
Author

tsuberim commented Jan 4, 2018

  • No IDE extension, same exact command on both yarn solium

soliumrc.json:

{
  "extends": "solium:all",
  "plugins": [
    "security"
  ],
  "rules": {
    "quotes": [
      "error",
      "double"
    ],
    "indentation": [
      "error",
      4
    ],
    "arg-overflow": [
      "warning",
      5
    ]
  }
}

.soliumignore::

node_modules
docs
  • yarn solium -V - 1.1.0
  • screenshots:

windows:

image

inside docker node (docker run -it node /bin/bash):
image

@duaraghav8
Copy link
Owner

@dev-matan-tsuberi The output you see on Ubuntu is the correct one.

Problem

You must've noticed that all (false positive) issues in windows stem from the whitespace-related rules - blank-lines, indentation, whitespace - they all analyse linebreaks in your code. Line break characters are usually different in un Unix (\n) and Windows (\r\n) and I should've accounted for the latter too.

^I'm yet to confirm this empirically but pretty sure this is the reason.

This went undetected for the past 1.5 years probably because almost all devs are using solium on Unix. Since I've always run Solium on Linux & Mac, I never noticed this myself!

Thanks for reporting this (massive) bug
Bottom line: Please use Solium on linux or Mac while I work on a fix:)

@GabrielAlacchi
Copy link
Contributor

@duaraghav8 PR #161 should fix the blank-lines rule for windows, since I changed the regular expressions to account for the \r\n line endings where necessary.

@tsuberim
Copy link
Author

tsuberim commented Feb 9, 2018

Is this being fixed?

@duaraghav8
Copy link
Owner

@dev-matan-tsuberi It has been partially fixed in the latest release (blank-lines shouldn't give you trouble any more) and will be completely fixed in the upcoming release (4-5 days)

@duaraghav8
Copy link
Owner

duaraghav8 commented Feb 14, 2018

v1.1.5 fully resolves this issue. @dev-matan-tsuberi I no longer get any unexpected issues on my windows machine.
Please let me know if the issue still persists for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants