标签: code-climate

从CodeClimate方法行检查中过滤渲染功能

我们将CodeClimate添加到项目中,并在React组件中method-linesrender功能中遇到很多错误,例如

函数render有78行代码(允许超过40行)。考虑重构。

我们想rendermethod-lines检查中过滤掉所有功能。我们可以增加线路阈值或完全禁用检查,但是我们仍然希望检查其他功能,所以这是不可取的。

有用于重复检查的节点过滤,但是我找不到类似的东西method-lines

reactjs code-climate

12
推荐指数
1
解决办法
201
查看次数

如何将Code Climate测试覆盖率报告覆盖到同一个提交

我使用的CC-测试记者上传的测试覆盖率结果Code ClimateCircleCI

但是运行相同的构建失败并显示以下消息:

Error: response from https://api.codeclimate.com/v1/test_reports.
HTTP 409: A test report for commit 
858d3fa0c92ec5a546bde3991f57523768dac0c2 already exists
Run Code Online (Sandbox Code Playgroud)

如何让它通过CI脚本或覆盖它而不会失败?

circleci code-climate

10
推荐指数
0
解决办法
246
查看次数

如何将travis ci与Python中的codeclimate测试覆盖率集成?

我正在尝试让我的Travis CI将测试覆盖率数据发送到Code Climate服务,但Code Climate和Travis CI的文档没有详细描述如何使用Python执行此操作.根据Code Climate和Travis文档,它仍然是其支持的功能.我试图在没有运气的情况下找到任何有关这方面的工作示例,并且无法使其自行运行.

代码气候文档: 设置测试覆盖率, 自述文件:codeclimate-test-reporter

Travis CI文档: 将Code Climate与Travis CI结合使用

我在Travis CI中设置了CODECLIMATE_REPO_TOKEN,如下所示:https://stackoverflow.com/a/31281481/1754089

我的.travis.yml文件:

language: python
python:
  - 2.7
install:
  - pip install -r requirements.txt
  - pip install coverage
  - pip install codeclimate-test-reporter
#commands to run tests:
script:
  - python mytests.py
  - coverage run mytests.py
after_success:
  - codeclimate-test-reporter
Run Code Online (Sandbox Code Playgroud)

因为在Travis中,after_success行已经完成了,它在日志视图中给出了这个:

/home/travis/build.sh: line 45: codeclimate-test_reporter: command not found
Run Code Online (Sandbox Code Playgroud)

python continuous-integration python-2.7 travis-ci code-climate

9
推荐指数
1
解决办法
1276
查看次数

如何配置代码气候以忽略带有日志语句的代码行

是否可以配置代码气候,因此它不计算仅记录的行数?

我喜欢每个函数都有一个阈值的想法,比如说 25 行,但在我看来,添加详细的日志记录不应造成代码气候问题。

typescript code-climate

7
推荐指数
0
解决办法
362
查看次数

如何为jenkins CI设置代码气候测试覆盖率

我正在使用代码环境来实现代码质量和测试覆盖率.我在spec_helper.rb中添加了gem和代码来启动覆盖.在下一步中,根据文档编写代码:在CI上运行测试时,设置CODECLIMATE_REPO_TOKEN环境变量:$ CODECLIMATE_REPO_TOKEN =********************bundle exec rake

我试图在jenkins的execute shell命令中设置上面的行.还尝试在Manage jenkins - > Configure System设置中设置环境变量CODECLIMATE_REPO_TOKEN.但这不起作用.我找不到任何用jenkins设置测试覆盖率的文档.任何帮助都会很明显.

根据代码 - 气候文档

Add the codeclimate-test-reporter gem to your Gemfile:
Run Code Online (Sandbox Code Playgroud)

gem"codeclimate-test-reporter",group :: test,require:nil

Start the test reporter on the very first line of spec_helper.rb or test_helper.rb:
Run Code Online (Sandbox Code Playgroud)

需要"codeclimate-test-reporter"CodeClimate :: TestReporter.start

When you run your tests on CI, set the CODECLIMATE_REPO_TOKEN environment variable:

$ CODECLIMATE_REPO_TOKEN=**************************** bundle exec rake

(Note: This token is specific to this repo on Code Climate.)

(Note: **As an alternative to the above, you may prefer to …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails jenkins code-climate

6
推荐指数
1
解决办法
1086
查看次数

修复`缺少冻结的字符串文字注释'问题

我创建了一个新的迁移,它看起来像这样:

class AddCommentsToUsers < ActiveRecord::Migration
  def change
    add_column :users, :comments, :text
  end
end
Run Code Online (Sandbox Code Playgroud)

现在有了Code Climate,我被警告了一个问题: Missing frozen string literal comment.

我试着像这样解决它:

# frozen_string_literal: true
class AddCommentsToUsers < ActiveRecord::Migration
  def change
    add_column :users, :comments, :text
  end
end
Run Code Online (Sandbox Code Playgroud)

但我仍然有同样的问题.我该如何解决?谢谢.

ruby ruby-on-rails rubocop code-climate ruby-2.3

5
推荐指数
1
解决办法
2748
查看次数

基于env变量的Tox运行命令

我目前的工作流程是在Travis CI上测试github PRs和Builds,使用tox测试pytest并将报告覆盖率报告给codeclimate.

travis.yml

os:
- linux
sudo: false
language: python
python:
- "3.3"
- "3.4"
- "3.5"
- "pypy3"
- "pypy3.3-5.2-alpha1"
- "nightly"
install: pip install tox-travis
script: tox
Run Code Online (Sandbox Code Playgroud)

tox.ini

[tox]
envlist = py33, py34, py35, pypy3, docs, flake8, nightly, pypy3.3-5.2-alpha1

[tox:travis]
3.5 = py35, docs, flake8

[testenv]
deps = -rrequirements.txt
platform =
    win: windows
    linux: linux
commands =
    py.test --cov=pyCardDeck --durations=10 tests

[testenv:py35]
commands =
    py.test --cov=pyCardDeck --durations=10 tests
    codeclimate-test-reporter --file .coverage
passenv =
    CODECLIMATE_REPO_TOKEN
    TRAVIS_BRANCH
    TRAVIS_JOB_ID
    TRAVIS_PULL_REQUEST …
Run Code Online (Sandbox Code Playgroud)

python travis-ci tox code-climate

5
推荐指数
1
解决办法
1036
查看次数

我可以使用我自己的插件或使用 CodeClimate 在 stylelint 引擎中扩展吗

在我的 stylelintrc.js

module.exports = { "extends": [ "stylelint-config-standard", "stylelint-config-css-modules", ], "plugins": [ "stylelint-performance-animation", ], ...

在 codeclimat.yaml 中,我打开 stylelint 引擎并在 codeclimete 上出现此错误

•• 时间:.engineConfig:0.049s 错误:找不到“stylelint-config-css-modules”。你需要configBasedir吗?有关更多信息,请参阅https://docs.codeclimate.com/docs/stylelint 上的文档。

有人可以解释一下如何启用插件和扩展吗?

code-climate stylelint

5
推荐指数
1
解决办法
1052
查看次数

将codeclimate与travis-ci集成,travis无法加载codeclimate-test-reporter

这是有问题的公共回购:https://travis-ci.org/agerwick/raw-sinatra-boilerplate

我按照这里的建议整合了codeclimate的测试记者宝石:http://docs.travis-ci.com/user/code-climate/

我一直得到的错误是: /home/travis/.rvm/rubies/ruby-2.0.0-p594/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in 'require': cannot load such file -- codeclimate-test-reporter (LoadError)

从下面的日志中可以看出,Travis CI正在安装codeclimate-test-reporter gem.我尝试使用CODECLIMATE_REPO_TOKEN环境变量集从我的本地计算机运行测试,并且它在这里工作得很好,更新了代码气候测试覆盖状态.因此,问题只出在travis上.

关于如何让Travis CI正确地要求codeclimate-test-reporter的任何建议?

出于历史目的,这是Travis CI的日志:

Using worker: worker-linux-9-1.bb.travis-ci.org:travis-linux-16
system_info
Build system information
Build language: ruby
git.checkout
0.06s$ git clone --depth=50 --branch=master git://github.com/agerwick/raw-sinatra-boilerplate.git agerwick/raw-sinatra-boilerplate
Cloning into 'agerwick/raw-sinatra-boilerplate'...
remote: Counting objects: 223, done.
remote: Compressing objects: 100% (51/51), done.
remote: Total 223 (delta 27), reused 0 (delta 0)
Receiving objects: 100% (223/223), 45.36 KiB | 0 bytes/s, done.
Resolving deltas: 100% (89/89), done. …
Run Code Online (Sandbox Code Playgroud)

travis-ci code-climate

2
推荐指数
1
解决办法
871
查看次数

Gitlab和代码气候-它真正涵盖了什么?没有?

我按照此gitlab文档(非常差的文档)设置代码质量步骤:https ://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html

现在,执行代码质量步骤,我得到了报告(完美)。

但是,似乎它并没有太多检查,下面是一个示例:

:["Complexity"],"check_name":"method_count","content":{"body":""},"description":"`Admis` has 78 methods (exceeds 20 allowed). Consider refactoring.","fingerprint":"3a31032b9aff6d8b119f276d03a3c391","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/admisDAO/Admis.java","lines":{"begin":14,"end":457}},"other_locations":[],"remediation_points":7000000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Complexity"],"check_name":"file_lines","content":{"body":""},"description":"File `Candidat.java` has 945 lines of code (exceeds 250 allowed). Consider refactoring.","fingerprint":"4f570943e9f89fac8caa554c7e78f993","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/candidatDAO/Candidat.java","lines":{"begin":1,"end":1184}},"other_locations":[],"remediation_points":11208000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Complexity"],"check_name":"method_count","content":{"body":""},"description":"`Candidat` has 232 methods (exceeds 20 allowed). Consider refactoring.","fingerprint":"4dbebf004d9f5f3a1fabf03c43699c01","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/candidatDAO/Candidat.java","lines":{"begin":14,"end":1184}},"other_locations":[],"remediation_points":22400000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Bug Risk"],"check_name":"TODO","description":"TODO found","location":{"lines":{"begin":28,"end":28},"path":"src/main/java/nc/unc/importparcoursup/view/components/CheckComponentAdmis.java"},"type":"issue","engine_name":"fixme","fingerprint":"d8d52d96fc27f9b0a1f9879e7d133345","severity":"minor"}]
Run Code Online (Sandbox Code Playgroud)
  • “ method_count和file_lines”:用于我的实体类,因此它们不是真正的错误(拆分实体类没有意义)
  • “找到TODO”:真正的问题好(检查代码质量!)

我知道还有很多其他问题。如果将代码放到sonarcube中,我会发现更多的问题)

所有错误(真正的错误)在哪里?

设置不好吗?

我的项目来源:https : //gitlab.com/tyvain/parcoursup

java gitlab-ci code-climate

2
推荐指数
1
解决办法
1282
查看次数

为什么Travis CI不会为我的Node应用程序运行CodeClimate脚本?

我按照说明将CodeClimate添加到我的.travis.yml文件中:

language: node_js
script:
  - gulp
  - npm test
after_script:
  - codeclimate < coverage/**/lcov.info
addons:
  code_climate:
    repo_token: [ my token ]
Run Code Online (Sandbox Code Playgroud)

我的构建中的所有内容都运行没有错误,除了最后的codeclimate脚本:

[0K$ codeclimate < coverage/**/lcov.info
/home/travis/build.sh: line 41: codeclimate: command not found
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

travis-ci code-climate

1
推荐指数
1
解决办法
879
查看次数