Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

jscs looking in .git folder #1707

Closed
bstream opened this issue Aug 20, 2015 · 11 comments
Closed

jscs looking in .git folder #1707

bstream opened this issue Aug 20, 2015 · 11 comments

Comments

@bstream
Copy link

bstream commented Aug 20, 2015

Found a weird issue when running jscs on my code. It appears that jscs . will look in dot-directories by default (for example .git). The error was triggered because my branch name ends in .js and jscs therefore tried to parse /.git/logs/refs/heads/branch.js.

> jscs .

parseError: undefined at ./.git/logs/refs/heads/branch.js :
     1 |0000000000000000000000000000000000000000 897bfdbcabdfa7ce535205c6b2c751bb0d84e69e Andreas Broström <andreas.brostrom@nordnet.se> 1440067510 +0200 branch: Created from HEAD
----------------------------------------------------^
     2 |

parseError: undefined at ./.git/refs/heads/branch.js :
     1 |897bfdbcabdfa7ce535205c6b2c751bb0d84e69e
-----------^
     2 |


2 code style errors found.

The example can be found at: https://github.com/bstream/jscs-js-branchname/tree/branch.js

This error can be fixed by supplying ".git" to the "excludeFiles"-list in .jscsrc, or by supplying the specific folders and files to be tested as arguments to jscs. However, maybe jscs should ignore hidden files by default? (Which is the case with for example ESLint, see eslint/eslint#1077)

@mrjoelkemp
Copy link
Member

.git sounds like a good default exception to add to excludeFiles.

If @markelog agrees, then would you be open to submitting a PR? We could use the help.

@markelog
Copy link
Member

+1 :)

@hzoo
Copy link
Member

hzoo commented Aug 20, 2015

Ignore all dot directories or .git specifically?

@iamstarkov
Copy link
Contributor

im going to create pr with ignoring all dot folders, is it ok?

@markelog
Copy link
Member

Nuh, #241

@iamstarkov
Copy link
Contributor

@markelog these changes will not break #241

iamstarkov added a commit to iamstarkov/node-jscs that referenced this issue Aug 20, 2015
@markelog
Copy link
Member

It seems we need to always ignore .git folder, otherwise user could redefine that value and will have same issue

@iamstarkov
Copy link
Contributor

imo, the same for node_modules

@iamstarkov
Copy link
Contributor

but its another issue

@markelog
Copy link
Member

It is different way of solving it

@markelog
Copy link
Member

@markelog these changes will not break #241

Why not?

@hzoo hzoo closed this as completed in b8c1972 Sep 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants