Giter VIP home page Giter VIP logo

coc-cfn-lint's Introduction

coc-cfn-lint

Coc (coc.nvim) extension for cfn-python-lint.

version license

Requirements

Install

Inside Vim/Neovim, run:

:CocInstall coc-cfn-lint

Features

  • Lints JSON/YAML CloudFormation or SAM templates upon open/save
    • Will attempt to run cfn-lint from your project root directory, in order to detect any project-specific configuration (.cfnlintrc, .cfnlintrc.yaml, or .cfnlintrc.yml)

Configuration

This extension can be configured via these top-level configuration items. Live reload of settings is also supported, which means you can change these settings without needing to reload the file/editor.

Setting Default Description
cfnlint.path "cfn-lint" Path to cfn-lint
cfnlint.lintOnOpen true Enable linting upon opening a valid CloudFormation JSON/YAML file
cfnlint.lintOnSave true Enable linting upon saving a valid CloudFormation JSON/YAML file
cfnlint.detectCfnRegExps [] Array of RegExp strings. If any of these match in a JSON/YAML file, that file will be linted. This can be useful to detect non-standard CloudFormation/SAM templates, as the built-in checks look for a standard CloudFormation/SAM template
cfnlint.ignoreRulesRegExps [] Array of RegExp strings. If any of these match a cfn-lint result message, that result is ignored. This can be useful alongside cfnlint.ignoreRules
cfnlint.awsRegions [] Array of AWS regions to test against. Defaults to all regions. This is useful because certain rules (such as "E3001") check whether resources are supported in the given regions
cfnlint.ignoreBadTemplate false Ignore bad template errors
cfnlint.ignoreRules [] Array of rule ID prefixes to ignore (e.g. ["E3", "E1029"])
cfnlint.includeRules [] Array of rule ID prefixes to include. Some checks, such as Informational checks (beginning with "I") are disabled by default, and can be enabled by setting this to ["I"]
cfnlint.customRules [] Array of paths containing additional rules. These can be either directories containing Python file(s), or an import path to a Python module
cfnlint.includeExperimentalRules false Whether to include experimental rules
cfnlint.ruleConfigurations [] Array of rule configurations (e.g. ["E3012:strict=false"]
cfnlint.overrideSpecPath null Path to a CloudFormation resource specification override file

License

MIT

coc-cfn-lint's People

Contributors

joenye avatar lagroujl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

coc-cfn-lint's Issues

Support SAM templates

You can run :CocInfo inside vim to see the coc-cfn-lint logs and you'll see whether your file is being detected as CloudFormation. It currently doesn't do this check by looking at filename. Instead, it looks at file contents. By default, it will detect the file as CloudFormation if it contains both "AWSTemplateFormatVersion" and "Resources". In my case, I'm working with non-standard template files that don't always contain both these lines, so I have set the cfnlint.detectCfnRegExps as follows:
"cfnlint.detectCfnRegExps": ["AWS::", "\n?"Resources"?\s*:"],

cfn-lint works out of the box on SAM templates as well. I would suggest to scan for both AWSTemplateFormatVersion and Transform: AWS::Serverless*

Just my 2 cents

Support linting on file change

Currently, the plugin can lint only onOpen or onSave. It would be convenient if it supported linting onChange as well.

coc_nvim_1.workspace.resolveRootFolder is not a function

This started appearing yesterday when opening CloudFormation templates. Unsure if the error and the warning are related, sorry if they are not.

2022-02-23T09:07:21.221 INFO (pid:3755) [plugin] - coc.nvim initialized with node: v17.5.0 after 45ms 2022-02-23T09:07:27.094 WARN (pid:3755) [workspace] - workspace.createOutputChannel is deprecated, please use window.createOutputChannel instead. at new CfnLintEngine (/Users/javi/.config/coc/extensions/node_modules/coc-cfn-lint/lib/index.js:181:51) at Object.<anonymous> (/Users/javi/.config/coc/extensions/node_modules/coc-cfn-lint/lib/index.js:106:16) 2022-02-23T09:07:27.095 ERROR (pid:3755) [extensions] - Error on active extension coc-cfn-lint: coc_nvim_1.workspace.resolveRootFolder is not a function TypeError: coc_nvim_1.workspace.resolveRootFolder is not a function at CfnLintEngine.<anonymous> (/Users/javi/.config/coc/extensions/node_modules/coc-cfn-lint/lib/index.js:190:62) at Generator.next (<anonymous>) at /Users/javi/.config/coc/extensions/node_modules/coc-cfn-lint/lib/index.js:166:71 at new Promise (<anonymous>) at __awaiter (/Users/javi/.config/coc/extensions/node_modules/coc-cfn-lint/lib/index.js:162:12) at CfnLintEngine.init (/Users/javi/.config/coc/extensions/node_modules/coc-cfn-lint/lib/index.js:187:16) at Object.<anonymous> (/Users/javi/.config/coc/extensions/node_modules/coc-cfn-lint/lib/index.js:129:22) at Generator.next (<anonymous>) at /Users/javi/.config/coc/extensions/node_modules/coc-cfn-lint/lib/index.js:99:71 at new Promise (<anonymous>)

nvim and coc versions:
vim version: NVIM v0.6.1 node version: v17.5.0 coc.nvim version: 0.0.80-3e0c33eca4 coc.nvim directory: /Users/javi/.local/share/nvim/plugged/coc.nvim term: alacritty platform: darwin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.