Skip to content

Commit

Permalink
style(lint): resolve errors
Browse files Browse the repository at this point in the history
1. Revert to sonar.branch instead of sonar.branch.name
2. Fix max-len warnings
3. Remove dependencies with nested vulnerabilities

#44,#187
  • Loading branch information
gregswindle committed Feb 16, 2018
1 parent 15afce9 commit ac4f18d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 20 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ addons:
secure: "$GH_TOKEN"
branches:
- master
- /[build|chore|ci|docs|feat|fix|perf|refactor|revert|spike|style|test].*/
- /[build|chore|ci|docs|feat|fix|perf|refactor|revert|spike|style|test]\/.*/
jdk:
- oraclejdk8

Expand Down Expand Up @@ -37,7 +37,6 @@ branches:

before_script:
- npm prune
- npm dedupe

script:
- echo "$TRAVIS_PULL_REQUEST_BRANCH"
Expand All @@ -47,7 +46,7 @@ after_script:
- cat docs/reports/coverage/lcov.info | npx coveralls
# Send stats to SonarCloud for pull requests
- test $TRAVIS_PULL_REQUEST != false
&& sonar-scanner -Dproject.settings=./sonar-project.properties -Dsonar.branch.name="$TRAVIS_PULL_REQUEST_BRANCH" -Dsonar.branch.target=master -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.login=$SONAR_TOKEN -X
&& sonar-scanner -Dproject.settings=./sonar-project.properties -Dsonar.branch=$TRAVIS_PULL_REQUEST_BRANCH -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.login=$SONAR_TOKEN -X

jobs:
include:
Expand Down
13 changes: 6 additions & 7 deletions lib/crc/crc-responsibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ const getPrimaryDescription =
class CrcResponsibility {
constructor (crcClass) {
this.comments = getComments(crcClass);

// This.all = getDescriptionsFromTags(this.comments);
}

/**
Expand Down Expand Up @@ -90,11 +88,12 @@ class CrcResponsibility {

static descriptionFromContext (context) {
const cxtComments = get(context, "code.ast.comments", []);
const comments = cxtComments.map((comment) => doctrine.parse(comment.value, {
"recoverable": true,
"sloppy": true,
"unwrap": true
}));
const comments =
cxtComments.map((comment) => doctrine.parse(comment.value, {
"recoverable": true,
"sloppy": true,
"unwrap": true
}));

const description =
getPrimaryDescription(comments) || getDescriptionFromTags(comments);
Expand Down
3 changes: 2 additions & 1 deletion lib/crc/prototypable.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const visitClass = (context) => {
*/

const visitNewExpression = (context) => {
const descriptor = "ExpressionStatement > [left.property.name=\"prototype\"]" +
const descriptor =
"ExpressionStatement > [left.property.name=\"prototype\"]" +
"[right.type=\"NewExpression\"]";
const node = queryContext(context, descriptor);
return {
Expand Down
3 changes: 2 additions & 1 deletion lib/crc/source-code-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const {SourceCode} = require("eslint");
*/

// eslint-disable-next-line security/detect-non-literal-fs-filename
const toSourceString = (filePath) => fs.readFileSync(path.resolve(filePath)).toString();
const toSourceString =
(filePath) => fs.readFileSync(path.resolve(filePath)).toString();

/**
* A helper object that generates ESLint
Expand Down
8 changes: 1 addition & 7 deletions lib/formatters/md/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,18 @@ module.exports = function format (results) {
const crcReporter = new CrcReporter();
const crcModels = crcReporter.report(results);

// Const codebase = crcReporter.codebase;

const toc = createTableOfContents(crcModels, tocFactory);

// Console.log(codebase);

decorateBuiltInsWithLinks(crcModels);
const models = crcModels.map((crcModel) => crcModelTemplate({
crcModel,
tocFactory
})).join("");

const report = crcPageTemplate({
return crcPageTemplate({
"date": new Date(),
"results": models,
"summary": `Object count: ${crcModels.length}`,
toc
});

return report;
};
3 changes: 2 additions & 1 deletion lib/formatters/md/toc-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const markdownToc = require("markdown-toc");

const mdnRef = new MdnReference();

const toSlug = (crcModel) => `${crcModel.class.meta.kind} ${crcModel.class.name}`;
const toSlug =
(crcModel) => `${crcModel.class.meta.kind} ${crcModel.class.name}`;

class TocFactory {
static toAnchor (crcModel) {
Expand Down

0 comments on commit ac4f18d

Please sign in to comment.