New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

codacy-coverage

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codacy-coverage - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

.eslintignore

5

bin/codacy-coverage.js

@@ -23,2 +23,3 @@ #!/usr/bin/env node

.option('-c, --commit [value]', 'Commit SHA hash')
.option('-l, --language [value', 'Project Language')
.option('-e, --endpoint [value]', 'Codacy API Endpoint')

@@ -35,4 +36,4 @@ .option('-p, --prefix [value]', 'Project path prefix')

loggerImpl.info(util.format('Started with: token [%j], commitId [%j], endpoint [%j], format [%j], path prefix [%j], verbose [%j], debug [%j]',
program.token, program.commit, program.endpoint, program.format, program.prefix, program.verbose, program.debug));
loggerImpl.info(util.format('Started with: token [%j], commitId [%j], language [%j], endpoint [%j], format [%j], path prefix [%j], verbose [%j], debug [%j]',
program.token, program.commit, program.language, program.endpoint, program.format, program.prefix, program.verbose, program.debug));

@@ -39,0 +40,0 @@ process.stdin.on('end', function () {

7

lib/handleInput.js

@@ -10,2 +10,3 @@ (function (parser, reporter, getGitData, logger, Promise, util) {

var pathPrefix = opts.prefix || '';
var language = opts.language || 'javascript';
var loggerImpl;

@@ -22,4 +23,4 @@

loggerImpl.info(util.format('Handling input for: token [%j], commitId [%j], endpoint [%j], format [%j], path prefix [%j], verbose [%j], debug [%j]',
token, commit, opts.endpoint, format, pathPrefix, opts.verbose, opts.debug));
loggerImpl.info(util.format('Handling input for: token [%j], commitId [%j], language [%j], endpoint [%j], format [%j], path prefix [%j], verbose [%j], debug [%j]',
token, commit, language, opts.endpoint, format, pathPrefix, opts.verbose, opts.debug));

@@ -33,5 +34,5 @@ // Parse the coverage data for the given format and retrieve the commit id if we don't have it.

endpoint: opts.endpoint
}).sendCoverage(token, commitId, parsedCoverage);
}).sendCoverage(token, commitId, language, parsedCoverage);
});
};
}(require('./coverageParser'), require('./reporter'), require('./getGitData'), require('./logger'), require('bluebird'), require('util')));

@@ -29,7 +29,7 @@ (function (request, Joi, Promise, util, logger) {

var endpoint = (options.endpoint || 'https://api.codacy.com') + '/2.0/coverage/:commitId/javascript';
var endpoint = (options.endpoint || 'https://api.codacy.com') + '/2.0/coverage/:commitId/:language';
logger.debug('Setting up reporter communicating to: ' + endpoint);
return {
sendCoverage: function sendCoverage(token, commitId, data) {
sendCoverage: function sendCoverage(token, commitId, language, data) {
return new Promise(function (resolve, reject) {

@@ -49,3 +49,3 @@ logger.trace(util.format('Sending Coverage for token [%s] and commitId [%s]', token, commitId));

var url = endpoint.replace(':commitId', commitId);
var url = endpoint.replace(':commitId', commitId).replace(':language', language);
logger.trace(util.format('Sending POST to %s', url));

@@ -59,3 +59,3 @@

// jscs:disable
'project_token': token
project_token: token
// jscs:enable

@@ -62,0 +62,0 @@ },

@@ -14,2 +14,2 @@ (function () {

})();
}());
{
"name": "codacy-coverage",
"version": "2.0.0",
"version": "2.0.1",
"description": "Code Coverage reporter for Codacy.com",

@@ -47,9 +47,9 @@ "keywords": [

"istanbul": "~0.x",
"jscs": "^1.x",
"jshint": "^2.x",
"jsinspect": "~0.x"
"jsinspect": "~0.x",
"eslint": "^3.x"
},
"scripts": {
"test": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --timeout 30000 --reporter spec test/ && jshint --show-non-errors . && jscs . && buddy index.js lib test && nsp check"
"test": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --timeout 30000 --reporter spec test/ && eslint . && buddy index.js lib test && nsp check",
"test-only": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --timeout 30000 --reporter spec test/ && buddy index.js lib test && nsp check"
}
}

@@ -37,2 +37,9 @@ # Node Codacy Coverage

**Enterprise**
To send coverage in the enterprise version you should specify your Codacy installation URL:
```
codacy-coverage -e <YOUR-URL>:16006
```
### [Mocha](http://mochajs.org) + [Blanket.js](https://github.com/alex-seville/blanket)

@@ -86,3 +93,35 @@ - Install [blanket.js](http://blanketjs.org/)

### Troubleshooting
The paths in your coverage file should be relative, if you are having problems with absolute paths, you can run our plugin with `-p .` to strip the current path from the paths in your coverage file:
```
cat ./coverage/lcov.info | node_modules/.bin/codacy-coverage -p .
```
To send coverage in the <strong>enterprise</strong> version you should specify your Codacy installation URL followed by the port 16006 using the -e option, example:
```
cat ./coverage/lcov.info | node_modules/.bin/codacy-coverage -e <YOUR-URL>:16006
```
## License
[MIT](LICENSE)
## What is Codacy?
[Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.
### Among Codacy’s features:
- Identify new Static Analysis issues
- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
- Auto-comments on Commits and Pull Requests
- Integrations with Slack, HipChat, Jira, YouTrack
- Track issues Code Style, Security, Error Proneness, Performance, Unused Code and other categories
Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.
Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.
### Free for Open Source
Codacy is free for Open Source projects.

@@ -64,4 +64,4 @@ (function (exec, Joi, parser, helper) {

expect(res).to.match(/Started with: token \["1234"], commitId \["4321"], endpoint \["something"], format \["lcov"], path prefix \["asdf\/"], verbose \[true], debug \[true]/);
expect(res).to.match(/Handling input for: token \["1234"], commitId \["4321"], endpoint \["something"], format \["lcov"], path prefix \["asdf\/"], verbose \[true], debug \[true]/);
expect(res).to.match(/Started with: token \["1234"], commitId \["4321"], language \[undefined], endpoint \["something"], format \["lcov"], path prefix \["asdf\/"], verbose \[true], debug \[true]/);
expect(res).to.match(/Handling input for: token \["1234"], commitId \["4321"], language \["javascript"], endpoint \["something"], format \["lcov"], path prefix \["asdf\/"], verbose \[true], debug \[true]/);
done();

@@ -68,0 +68,0 @@ });

@@ -48,5 +48,5 @@ (function (handleInput, helper, Joi, request, fs, path) {

}).promise()).to.eventually.satisfy(function (res) {
expect(res.statusCode).to.equal(200);
return true;
});
expect(res.statusCode).to.equal(200);
return true;
});
});

@@ -137,3 +137,3 @@ });

commit: '4321',
prefix: 'my-project/'
prefix: 'my-project' + path.sep
})).to.eventually.be.fulfilled();

@@ -140,0 +140,0 @@ });

@@ -52,3 +52,3 @@ (function (fs, parser, helper, path) {

it('should be able to parse lcov data with path prefix', function () {
return expect(parser.getParser('lcov').parse(path.normalize('my-project/'), lcovData))
return expect(parser.getParser('lcov').parse(path.normalize('my-project' + path.sep), lcovData))
.to.eventually.satisfy(function (data) {

@@ -55,0 +55,0 @@ expect(data).to.deep.equal({

@@ -47,5 +47,5 @@ (function (Joi, request, reporter, helper) {

}).promise()).to.eventually.satisfy(function (res) {
expect(res.statusCode).to.equal(200);
return true;
});
expect(res.statusCode).to.equal(200);
return true;
});
});

@@ -57,3 +57,3 @@ });

return expect(reporter({})
.sendCoverage('1234', '4321', sampleCoverageData))
.sendCoverage('1234', '4321', 'javascript', sampleCoverageData))
.to.eventually.be.rejectedWith(Error, 'child "fileReports" fails because ["fileReports" does not contain 1 required value(s)]');

@@ -70,3 +70,3 @@ });

return expect(reporter({})
.sendCoverage('1234', '4321', sampleCoverageData))
.sendCoverage('1234', '4321', 'javascript', sampleCoverageData))
.to.eventually.be.fulfilled();

@@ -79,3 +79,3 @@ });

return expect(reporter({})
.sendCoverage('1234', '4321', sampleCoverageData))
.sendCoverage('1234', '4321', 'javascript', sampleCoverageData))
.to.eventually.be.rejectedWith(Error, 'Expected Status Code of 200, but got [204]');

@@ -88,3 +88,3 @@ });

return expect(reporter({})
.sendCoverage('1234', '4321', sampleCoverageData))
.sendCoverage('1234', '4321', 'javascript', sampleCoverageData))
.to.eventually.be.rejectedWith(Error, 'Expected Successful Status Code, but got [418]');

@@ -91,0 +91,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc