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

Running on codeclimate.com fails with a FatalError #26

Closed
kimburgess opened this issue May 8, 2017 · 12 comments
Closed

Running on codeclimate.com fails with a FatalError #26

kimburgess opened this issue May 8, 2017 · 12 comments

Comments

@kimburgess
Copy link

While the engine works locally (invoked by codeclimate analyze), it fails with a FatalError on codeclimate.com.

This appears to be to do with the search for the tslint config, but haven't looked too deeply.

Output from the codeclimate.com process:

/usr/src/app/node_modules/tslint/lib/configuration.js:56
        throw new error_1.FatalError("Failed to load " + path + ": " + error.message, error);
        ^

Error
    at new FatalError (/usr/src/app/node_modules/tslint/lib/error.js:40:23)
    at Object.findConfiguration (/usr/src/app/node_modules/tslint/lib/configuration.js:56:15)
    at new TsLinter (/usr/src/app/dist/tsLinter.js:31:57)
    at Object.<anonymous> (/usr/src/app/dist/index.js:22:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)

Source where this can be replicated can be found at https://github.com/acaprojects/a2-portal/.

Quick links to config files of interest at time of this issue (in case they change):

@avegancafe
Copy link
Contributor

Thanks for the issue @kimburgess ! I think this has to do with your use of codelyzer, looks like @tkqubo made an issue a while ago to track this: #23

@pciavald
Copy link

pciavald commented Sep 25, 2017

It seems I'm getting the same issue but it's not related to coldelyzer. I have received this answer from CodeClimate support :

I believe what's happening here is related to us not installing a repo's node_modules when running our engines. For other repos where I've seen this pop up:

when you run npm install locally to get a local node_modules directory containing the library (and then use our CLI to analyze your repo locally), you won't encounter this issue.

The catch with that is we haven't figured out a good way to install the node_modules that are specified in a project that doesn't break aspects of the limits we place on engines for security reasons, and so it's going to take a bit more work on our side to map that work out and get it moving.

Really sorry about the inconvenience with this in the meantime. It looks like someone else has opened an issue on the TSLint engine here: #26 -- if you'd like, feel free to add to that or track it to get alerts on the changes with that.

@abalad
Copy link

abalad commented Sep 26, 2017

How was that resolved? Because I'm having the same problem.

/usr/src/app/node_modules/tslint/lib/configuration.js:56
        throw new error_1.FatalError("Failed to load " + path + ": " + error.message, error);
        ^
Error
    at new FatalError (/usr/src/app/node_modules/tslint/lib/error.js:40:23)
    at Object.findConfiguration (/usr/src/app/node_modules/tslint/lib/configuration.js:56:15)
    at new TsLinter (/usr/src/app/dist/tsLinter.js:31:57)
    at Object.<anonymous> (/usr/src/app/dist/index.js:22:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)

@avegancafe
Copy link
Contributor

@abalad @pciavald only the following rule sets are supported by codeclimate-tslint:

{
    "tslint-config-airbnb": "5.0.0",
    "tslint-config-standard": "5.0.2",
    "tslint-eslint-rules": "4.0.0",
    "tslint-react": "3.0.0"
}

This is because on codeclimate, they do not re-install your node modules. If you are using another set of rules, it will fail because we only install a select number of tslint presets

@alvis
Copy link

alvis commented Oct 11, 2017

@kyleholzinger Got it. Thanks for the explanation.

Now the problem is that probably we need more pre-selected packages. In fact, I am here because I have an issue with tslint-config-prettier.

The problem is that, in order to make prettier work well with tslint, tslint-config-prettier is needed to avoid contradicting rules. However, as the package is not pre-installed on code climate, builds will fail. It works fine only if I remove tslint-config-prettier from tslint.json.

prettier is useful and I don't want to give it up for codeclimate. Any chance we can include this in the selection?

@andrewfader
Copy link

andrewfader commented Dec 4, 2017

I've got this problem as well. I'm not sure what the package is that's breaking. Any idea how to debug it?
Edit: nevermind. It is Codelyzer

gund added a commit to gund/ng-preset that referenced this issue Jan 2, 2018
gund added a commit to gund/ng-preset that referenced this issue Jan 2, 2018
proustibat added a commit to proustibat/fbrgsmn.mobile.app that referenced this issue Jan 22, 2018
CodeClimate doesn't support a lot of rule sets for now:
tkqubo/codeclimate-tslint#26 (comment)
@mltsy
Copy link

mltsy commented Jun 6, 2019

I'm still a bit confused about how this works (or rather doesn't work) - I see PR #41 was merged a few months ago, adding "codelyzer rules"...

Should I be able to use these codelyzer rules on CodeClimate now if I specify them it the right way? My current config includes "rulesDirectory": ["codelyzer"] and is failing.

Forgive me if I'm missing obvious points, as I'm not familiar with angular, codelyzer or tslint (I'm implementing a standardized CI pipeline that extends to projects I don't work on). I see @kyleholzinger noted above that only 4 tslint presets were supported, but that was 2 years ago, and I don't know what part of this repository defines which presets are included in that list, or whether they could/do now include codelyzer rules... ?? Any insight on how to get this TSLint running on CodeClimate using codelyzer rules would be appreciated! 😄

@avegancafe
Copy link
Contributor

@mltsy I'm no longer involved with this project anymore, but the package.json is where those dependencies are declared. In terms of troubleshooting though, I'm not sure if the new version of this has been deployed in codeclimate. Basically the reason for this is that codeclimate doesn't install any packages from your repo when it lints your code, so any linter plugins or anything have to be available in thsi repo's package.json in order to be available for usage in your app's config

@mltsy
Copy link

mltsy commented Jun 6, 2019

Thanks for the assistance even though you're not on the project anymore! So from what I understand, because codelyzer is now included as a dependency in package.json, we should be able to use the rulesDirectory from codelyzer in our own tslint.json files on CodeClimate, assuming CodeClimate is using the latest version of this plugin, right? (And as long as I figure out the correct syntax for doing so). And then this issue could be resolved... anybody know what that syntax should be?

@avegancafe
Copy link
Contributor

That sounds about right @mltsy! I'm not sure how codelyzer works specifically, but I'd assume it's the same as any other plugin for tslint

@mltsy
Copy link

mltsy commented Aug 9, 2019

Wow! All I had to do was change "rulesDirectory": ["codelyzer"] to "rulesDirectory": ["node_modules/codelyzer"] (as shown in the tslint.json file linked frmo the original post. I know CodeClimate has updated their tslint version since this issue was created, so now I'm curious if this issue is also resolved for the original repository @kimburgess? (If you're still on the project, and using CodeClimate on it 2 years later!) Maybe we can close this issue!

@kimburgess
Copy link
Author

That project is no longer under active development, but from a quick look at #41 and this comment it seems there should be a high chance this is fixed.

I'll close this off so there's not a zombie issue here.

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

7 participants