Ace linters – 所有注释的类型都是错误

huangapple go评论54阅读模式
英文:

Ace linters - All annotations are of type error

问题

I'm using ace-linters for ace editor to perform linting for languages like python, sql, json etc. The linting works pretty good with the help of web workers. It returns the proper annotations. But all the annotations are marked as error type even if some of them, according to me, should be warning annotations. Please refer below example.

Is there a way to fix this issue? by either controlling the error codes or just the annotations as they are returned.

英文:

I m using ace-linters for ace editor to perform linting for languages like python, sql, json etc

The linting works pretty good with the help of web workers.
It returns the proper annotations.
But all the annotations are marked as error type even if some of them, according to me, should be warning annotations. Please refer below example

Is there a way to fix this issue? by either controlling the error codes or just the annotations as they are returned

[
    {
        "row": 0,
        "column": 7,
        "text": "F401 `pandas` imported but unused",
        "type": "error"
    },
    {
        "row": 2,
        "column": 18,
        "text": "F401 `pandas` imported but unused",
        "type": "error"
    },
    {
        "row": 2,
        "column": 44,
        "text": "F401 `numpy` imported but unused",
        "type": "error"
    },
    {
        "row": 3,
        "column": 88,
        "text": "E501 Line too long (136 > 88 characters)",
        "type": "error"
    },
    {
        "row": 6,
        "column": 88,
        "text": "E501 Line too long (112 > 88 characters)",
        "type": "error"
    },
    {
        "row": 8,
        "column": 88,
        "text": "E501 Line too long (93 > 88 characters)",
        "type": "error"
    },
    {
        "row": 10,
        "column": 88,
        "text": "E501 Line too long (173 > 88 characters)",
        "type": "error"
    },
    {
        "row": 12,
        "column": 88,
        "text": "E501 Line too long (90 > 88 characters)",
        "type": "error"
    },
    {
        "row": 14,
        "column": 88,
        "text": "E501 Line too long (101 > 88 characters)",
        "type": "error"
    },
    {
        "row": 18,
        "column": 88,
        "text": "E501 Line too long (128 > 88 characters)",
        "type": "error"
    }
]

答案1

得分: 2

你可以通过将要忽略的规则前缀提供给configurationignore属性来设置要忽略的规则列表:

languageProvider.setGlobalOptions("python", {
    configuration: {
        "ignore": ["E501", "F401"]
    }
});
英文:

You could set the list of rules you want to ignore by providing their prefixes to the ignore property of configuration:

languageProvider.setGlobalOptions("python", {
    configuration: {
        "ignore": ["E501", "F401"]
    }
});

huangapple
  • 本文由 发表于 2023年4月13日 20:18:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76005347.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定