问题标签 [codenarc]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
grails - Grails: Turn off Codenarc NoDef rule for controller actions
Is there a way to turn off the Codenarc NoDef rule for Grails controller actions? The rule is a good practice to follow in general but since some actions return a value and some don't, we typically use def to support all variants. I looked around a bit to see if this rule can be turned off for controller actions but came up empty. Does anyone know?
groovy - 如何将 CodeNarc 规则添加到 Sonar Groovy 插件
CodeNarc 有 346 条规则,但 Sonar Groovy 插件(利用 CodeNarc)只使用其中的 59 条规则。
我需要在 Sonar 中添加更多规则到 Groovy 分析中。我怎样才能做到这一点?
谢谢
mysql - Grails 域 - 保留的关键字名称
所以我终于引入codenarc
了我的项目的构建过程,我收到了以下警告 - GrailsDomainReservedSqlKeywordName
。
问题是我有很多这样的警告,即因为我已经将很多域字段命名为data
. 例如
根据这个效果codenarc
是
使用这样的关键字命名域类(或其字段)会导致 SQL 模式创建错误和/或冗余表/列名称映射。
我的问题是:我现在是否应该重命名我的所有data
属性,如果是,如何最好地做到这一点(也许使用数据库迁移)?
我只是想知道为什么 Grails 文档没有警告不要使用这些保留关键字。也许他们应该。
grails - Grails/groovy项目的静态代码分析
如果我在声纳中安装groovy插件后使用sonarqube作为grails项目的静态代码分析工具,那么它是否也在内部使用codenarc,还是我必须在grails中使用codenarc插件单独使用项目的codenarc分析?
基本上,sonarqube 足以进行静态代码分析还是我也应该使用 codenarc?
gradle - 在 Gradle 中使用 CodeNarc 生成多种报告类型
我想在 Gradle 的 CodeNarc 中生成 HTML 和控制台报告。
我的build.gradle
:
这很好用,但我也希望在控制台上显示报告,因为现在那里只显示指向 HTML 的链接。如何请求多种报告类型?
intellij-idea - 修复 IntelliJ IDEA 中不必要的 GString 违规
当我使用 CodeNarc 分析我的项目时,我得到了大量的UnnecessaryGString
违规行为。
ALT我可以通过按+ENTER并选择Convert to String
选项来一一修复它们。虽然这是一个非常乏味的过程。
IntelliJ 中是否有任何自动修复可以用字符串替换所有不必要的 GString?如果没有,我需要做什么来创建自己的?
目前我使用容易出错的替换从"([^$\n"]+)"(?!\()
to '$1'
。它在更复杂的情况下(例如转义)给出了一些误报。
grails - 用于 Grails 1.3.9 的 Grails codenarc 插件
搜索插件站点和其他资源,我找不到必须为我的 Grails 版本安装的插件版本。有人可以帮我吗?
grails - 仅在 Jenkins 违规报告中显示 codenarc 优先级 1 和 2
有没有办法可以从 Jenkins 图表中排除优先级 3 违规?其他 codenarc 报告类型,如 'html' 或 'sortable' 有一个maxPriority选项,它完全符合我的要求,但 type=xml 报告不存在该选项。
帮助?
细节:
我使用codenarc作为我的 Groovy / Grails 项目的类似 lint 的源代码分析工具。
Jenkins Violations Plugin支持 codenarc(以及其他),并允许 Jenkins 作业不仅显示 HTML codenarc 报告,而且如果您有 1 个或多个高优先级违规,则构建失败。
这一切都很好,但我不希望任何优先级 3(低级别)违规出现在违规插件在 Jenkins 中创建的漂亮图表中。
这更像是一个视觉吸引力的问题,而不是其他任何事情。我根本不希望出现低级别违规行为。
我是否只能选择通过对最初生成的 xml 文件进行后处理来删除所有优先级 3 引用?正则表达式来救援。在那种情况下,我想我添加了一个构建步骤,它是一个 Groovy 脚本,它在评估违规之前运行?
groovy - CodeNarc Maven Plugin
We have a project that uses Groovy extensively and we use Maven to build our artifacts. (IntelliJ as our IDE)
We wanted to incorporate some automated code-style checking, and thought we might use codecarc-maven-plugin. However, since that was from Codehaus, which gone now, is the plugin actively supported somewhere else?
Any other good options to run a Groovy style checker automatically during a Maven build?
gradle - 用于 codnarcTest 的 gradle 中的 ignoreFailures
通常在 gradle 中,我有打开大多数规则的 codenarc 设置。
我能够在主源集中将违规减少到一个非常小的数字,我想设置最大违规并允许 codenarc 在将违规添加到项目时使构建失败。
我的问题是 codenarcTest 有大量违规行为。我尝试设置 codenarcTest 以忽略失败:
由于某种原因,Gradle 无法以这种方式配置任务。
如何将 codenarcTest 设置为 ignoreFailures 并将 codenarcMain 设置为不忽略Failures?