From 7e986c38e1abbf9489759e660842d1efff8ae6cd Mon Sep 17 00:00:00 2001 From: Frank van Boven Date: Wed, 2 Jan 2019 12:57:59 +0100 Subject: [PATCH] Improve severity handling --- lib/atom-cfn-lint.js | 18 ++++- package.json | 168 +++++++++++++++++++++---------------------- 2 files changed, 101 insertions(+), 85 deletions(-) diff --git a/lib/atom-cfn-lint.js b/lib/atom-cfn-lint.js index 74c9850..894c23f 100644 --- a/lib/atom-cfn-lint.js +++ b/lib/atom-cfn-lint.js @@ -203,8 +203,24 @@ module.exports = { sourceUrl = match.Rule.Source } + + // Map the linter severity into the Atom linter values (error, warning, info) + // See: https://steelbrain.me/linter/types/linter-message-v2.html + let linterSeverity + + switch (match.Level) { + case 'Informational': + linterSeverity = 'info' + break + case 'Warning': + linterSeverity = 'warning' + break + default: + linterSeverity = 'error' + } + toReturn.push({ - severity: match.Level.toLowerCase(), + severity: linterSeverity, excerpt: match.Message, url: sourceUrl, location: { diff --git a/package.json b/package.json index 3af1d63..dca9fc9 100644 --- a/package.json +++ b/package.json @@ -1,84 +1,84 @@ -{ - "name": "atom-cfn-lint", - "main": "./lib/atom-cfn-lint", - "version": "0.6.0", - "description": "Validate CloudFormation yaml/json templates against the CloudFormation spec and additional checks. Includes checking valid values for resource properties and best practices.", - "keywords": [ - "linter", - "AWS", - "CloudFormation" - ], - "repository": "https://github.com/awslabs/aws-cfn-lint-atom", - "license": "Apache-2.0", - "engines": { - "atom": ">=1.0.0 <2.0.0" - }, - "dependencies": { - "atom-linter": "^5.0.2", - "atom-package-deps": "^4.6.0" - }, - "package-deps": [ - "linter" - ], - "scripts": { - "test": "apm test", - "lint": "eslint lib spec" - }, - "providedServices": { - "linter": { - "versions": { - "2.0.0": "provideLinter" - } - } - }, - "readmeFilename": "README.md", - "devDependencies": { - "babel-eslint": "latest", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-plugin-import": "^2.9.0", - "jasmine-fix": "^1.3.0" - }, - "eslintConfig": { - "extends": "airbnb-base", - "rules": { - "no-console": "off", - "semi": [ - "error", - "never" - ], - "comma-dangle": "off", - "global-require": "off", - "import/no-unresolved": [ - "error", - { - "ignore": [ - "atom" - ] - } - ], - "object-curly-newline": [ - "error", - { - "ObjectExpression": { - "minProperties": 5, - "multiline": true, - "consistent": true - }, - "ObjectPattern": { - "minProperties": 5, - "multiline": true, - "consistent": true - } - } - ] - }, - "globals": { - "atom": "true" - }, - "env": { - "node": true, - "browser": true - } - } -} +{ + "name": "atom-cfn-lint", + "main": "./lib/atom-cfn-lint", + "version": "0.6.1", + "description": "Validate CloudFormation yaml/json templates against the CloudFormation spec and additional checks. Includes checking valid values for resource properties and best practices.", + "keywords": [ + "linter", + "AWS", + "CloudFormation" + ], + "repository": "https://github.com/awslabs/aws-cfn-lint-atom", + "license": "Apache-2.0", + "engines": { + "atom": ">=1.0.0 <2.0.0" + }, + "dependencies": { + "atom-linter": "^5.0.2", + "atom-package-deps": "^4.6.0" + }, + "package-deps": [ + "linter" + ], + "scripts": { + "test": "apm test", + "lint": "eslint lib spec" + }, + "providedServices": { + "linter": { + "versions": { + "2.0.0": "provideLinter" + } + } + }, + "readmeFilename": "README.md", + "devDependencies": { + "babel-eslint": "latest", + "eslint": "^4.19.1", + "eslint-config-airbnb-base": "^12.1.0", + "eslint-plugin-import": "^2.9.0", + "jasmine-fix": "^1.3.0" + }, + "eslintConfig": { + "extends": "airbnb-base", + "rules": { + "no-console": "off", + "semi": [ + "error", + "never" + ], + "comma-dangle": "off", + "global-require": "off", + "import/no-unresolved": [ + "error", + { + "ignore": [ + "atom" + ] + } + ], + "object-curly-newline": [ + "error", + { + "ObjectExpression": { + "minProperties": 5, + "multiline": true, + "consistent": true + }, + "ObjectPattern": { + "minProperties": 5, + "multiline": true, + "consistent": true + } + } + ] + }, + "globals": { + "atom": "true" + }, + "env": { + "node": true, + "browser": true + } + } +}