violations gradle plugin
v3.0.2
هذا هو البرنامج المساعد Gradle للانتهاكات lib. هناك أيضا مكون إضافي Maven لهذا الغرض.
| إصدار | نسخة جافا |
|---|---|
| الإصدار <2.0.0 | 8 |
| 2.0.0 <= الإصدار | 11 |
تم نشره إلى plugins.gradle.org.
يمكن أن يحلل النتائج من تحليل الكود الثابت و:
يمكنك أيضًا القيام بذلك باستخدام أداة سطر الأوامر.
قد يبدو مقتطف من الإخراج هكذا:
...
se/bjurr/violations/lib/example/OtherClass.java
╔══════════╤════════════╤══════════╤══════╤════════════════════════════════════════════════════╗
║ Reporter │ Rule │ Severity │ Line │ Message ║
╠══════════╪════════════╪══════════╪══════╪════════════════════════════════════════════════════╣
║ Findbugs │ MS_SHOULD_ │ INFO │ 7 │ Field isn ' t final but should be ║
║ │ BE_FINAL │ │ │ ║
║ │ │ │ │ ║
║ │ │ │ │ <p> ║
║ │ │ │ │ This static field public but not final, and ║
║ │ │ │ │ could be changed by malicious code or ║
║ │ │ │ │ by accident from another package. ║
║ │ │ │ │ The field could be made final to avoid ║
║ │ │ │ │ this vulnerability.</p> ║
╟──────────┼────────────┼──────────┼──────┼────────────────────────────────────────────────────╢
║ Findbugs │ NM_FIELD_N │ INFO │ 6 │ Field names should start with a lower case letter ║
║ │ AMING_CONV │ │ │ ║
║ │ ENTION │ │ │ ║
║ │ │ │ │ <p> ║
║ │ │ │ │ Names of fields that are not final should be in mi ║
║ │ │ │ │ xed case with a lowercase first letter and the fir ║
║ │ │ │ │ st letters of subsequent words capitalized. ║
║ │ │ │ │ </p> ║
╚══════════╧════════════╧══════════╧══════╧════════════════════════════════════════════════════╝
Summary of se/bjurr/violations/lib/example/OtherClass.java
╔══════════╤══════╤══════╤═══════╤═══════╗
║ Reporter │ INFO │ WARN │ ERROR │ Total ║
╠══════════╪══════╪══════╪═══════╪═══════╣
║ Findbugs │ 2 │ 0 │ 0 │ 2 ║
╟──────────┼──────┼──────┼───────┼───────╢
║ │ 2 │ 0 │ 0 │ 2 ║
╚══════════╧══════╧══════╧═══════╧═══════╝
Summary
╔════════════╤══════╤══════╤═══════╤═══════╗
║ Reporter │ INFO │ WARN │ ERROR │ Total ║
╠════════════╪══════╪══════╪═══════╪═══════╣
║ Checkstyle │ 4 │ 1 │ 1 │ 6 ║
╟────────────┼──────┼──────┼───────┼───────╢
║ Findbugs │ 2 │ 2 │ 5 │ 9 ║
╟────────────┼──────┼──────┼───────┼───────╢
║ │ 6 │ 3 │ 6 │ 15 ║
╚════════════╧══════╧══════╧═══════╧═══════╝مثال على التقارير المدعومة متوفرة هنا.
تم تنفيذ عدد من المحللين . يمكن لبعض المحللين تحليل الإخراج من العديد من المراسلين .
| مراسل | محلل | ملحوظات |
|---|---|---|
| ARM-GCC | CLANG | |
| Androidlint | ANDROIDLINT | |
| Ansible-later | ANSIBLELATER | بتنسيق json |
| Ansiblelint | FLAKE8 | مع -p |
| اللصوص | CLANG | مع bandit -r examples/ -f custom -o bandit.out --msg-template "{abspath}:{line}: {severity}: {test_id}: {msg}" |
| كلانج | CLANG | |
| CPD | CPD | |
| cppcheck | CPPCHECK | مع cppcheck test.cpp --output-file=cppcheck.xml --xml |
| cpplint | CPPLINT | |
| CSSLINT | CSSLINT | |
| CheckStyle | CHECKSTYLE | |
| cloudformation linter | JUNIT | cfn-lint . -f junit --output-file report-junit.xml |
| CodecLimate | CODECLIMATE | |
| Codenarc | CODENARC | |
| تغطية | COVERITY | |
| دارت | MACHINE | مع dart analyze --format=machine |
| فحص التبعية | SARIF | باستخدام --format SARIF |
| Detekt | CHECKSTYLE | مع- --output-format xml . |
| docfx | DOCFX | |
| Doxygen | CLANG | |
| erb | CLANG | مع erb -P -x -T '-' "${it}" | ruby -c 2>&1 >/dev/null | grep '^-' | sed -E 's/^-([a-zA-Z0-9:]+)/${filename}1 ERROR:/p' > erbfiles.out . |
| eslint | CHECKSTYLE | مع format: 'checkstyle' . |
| FindBugs | FINDBUGS | |
| Flake8 | FLAKE8 | |
| FXCOP | FXCOP | |
| مجلس التعاون الخليجي | CLANG | |
| GHS | GHS | |
| Gendarme | GENDARME | |
| مراسل عام | GENERIC | سيقوم بإنشاء انتهاك واحد مع كل المحتوى كرسالة. |
| جولينت | GOLINT | |
| حوكمة | GOLINT | نفس التنسيق مثل Golint. |
| Golangci-lint | CHECKSTYLE | مع- --out-format=checkstyle . |
| GoogleRrorProne | GOOGLEERRORPRONE | |
| Hadolint | CHECKSTYLE | مع -f checkstyle |
| إيار | IAR | مع --no_wrap_diagnostics |
| استدلال | PMD | استنتاج الفيسبوك. مع- --pmd-xml . |
| جاكوكو | JACOCO | |
| jCreport | JCREPORT | |
| jshint | JSLINT | مع --reporter=jslint أو محلل CheckStyle مع --reporter=checkstyle |
| جونيت | JUNIT | أنه يحتوي فقط على الفشل. |
| ktlint | CHECKSTYLE | |
| Klocwork | KLOCWORK | |
| Kotlingradle | KOTLINGRADLE | الإخراج من البرنامج المساعد Kotlin Gradle. |
| Kotlinmaven | KOTLINMAVEN | الإخراج من البرنامج المساعد Kotlin Maven. |
| الوبر | LINT | تنسيق XML شائع ، تستخدمه المبيدات المختلفة. |
| msbuildlog | MSBULDLOG | مع استخدام -fileLogger .*msbuild\.log$ كنمط أو -fl -flp:logfile=MyProjectOutput.log;verbosity=diagnostic |
| MSCPP | MSCPP | |
| مكابي | FLAKE8 | |
| mypy | MYPY | |
| نولواي | GOOGLEERRORPRONE | نفس التنسيق مثل Google Error Prone. |
| Pclint | PCLINT | PC-lint باستخدام نفس تنسيق الإخراج مثل البرنامج المساعد Jenkins تحذيرات ، التفاصيل هنا |
| PHPCs | CHECKSTYLE | مع phpcs api.php --report=checkstyle . |
| PHPPMD | PMD | مع phpmd api.php xml ruleset.xml . |
| PMD | PMD | |
| PEP8 | FLAKE8 | |
| perlcritic | PERLCRITIC | |
| حفز | PITEST | |
| بروتولنت | PROTOLINT | |
| دمية لينت | CLANG | مع -log-format %{fullpath}:%{line}:%{column}: %{kind}: %{message} |
| Pydocstyle | PYDOCSTYLE | |
| بيفليك | FLAKE8 | |
| بيلنت | PYLINT | مع pylint --output-format=parseable . |
| Resharper | RESHARPER | |
| Rubycop | CLANG | مع rubycop -f clang file.rb |
| ساريف | SARIF | v2.x. يمكن لـ Microsoft Visual C# إنشاءه باستخدام ErrorLog="BuildErrors.sarif,version=2" . |
| Sbtscalac | SBTSCALAC | |
| scalastyle | CHECKSTYLE | |
| Semgrep | SEMGREP | مع --json . |
| قردي | SIMIAN | |
| السونار | SONAR | مع mvn sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.report.export.path=sonar-report.json . تمت إزالة في 7.7 ، انظر Sonar-11670 ولكن يمكن استرجاعها بـ: curl --silent 'http://sonar-server/api/issues/search?componentKeys=unique-key&resolved=false' | jq -f sonar-report-builder.jq > sonar-report.json . |
| بقعة سبوت | FINDBUGS | |
| Stylecop | STYLECOP | |
| swiftlint | CHECKSTYLE | مع --reporter checkstyle . |
| tslint | CHECKSTYLE | مع -t checkstyle |
| فالغريند | VALGRIND | مع --xml=yes . |
| xmllint | XMLLINT | |
| xunit | XUNIT | أنه يحتوي فقط على الفشل. |
| Yamllint | YAMLLINT | مع -f parsable |
| Zptlint | ZPTLINT |
52 تحليلات و 79 مراسلين.
في عداد المفقودين تنسيق؟ افتح مشكلة هنا!
هناك مثال قيد التشغيل هنا.
إن وجود ما يلي في برنامج Build Script سيجعل المكون الإضافي يعمل مع ./gradlew build .
plugins {
id " se.bjurr.violations.violations-gradle-plugin " version " X "
}
task violations ( type : se.bjurr.violations.gradle.plugin.ViolationsTask ) {
//
// Optional config
//
maxReporterColumnWidth . set( 0 ) // 0 is disabled
maxRuleColumnWidth . set( 10 )
maxSeverityColumnWidth . set( 0 )
maxLineColumnWidth . set( 0 )
maxMessageColumnWidth . set( 50 )
codeClimateFile . set(file( ' code-climate-file.json ' )) // Will create a CodeClimate JSON report.
violationsFile . set(file( ' violations-file.json ' )) // Will create a normalized JSON report.
//
// Global configuration, remove if you dont want to report violations for
// the entire repo.
//
minSeverity . set(se . bjurr . violations . lib . model . SEVERITY . INFO ) // INFO, WARN or ERROR
detailLevel . set( se.bjurr.violations.git.ViolationsReporterDetailLevel . VERBOSE ) // PER_FILE_COMPACT, COMPACT or VERBOSE
maxViolations . set( 99999999 ) // Will fail the build if total number of found violations is higher
printViolations . set( true ) // Will print violations found in diff
//
// Diff configuration, remove if you dont want to report violations for
// files changed between specific revisions.
//
// diff-properties can be supplied with something like:
//
// ./gradlew violations -i -PdiffFrom=e4de20e -PdiffTo=HEAD
//
// And in Travis, you could add:
//
// script:
// - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./gradlew check -PdiffFrom=$TRAVIS_PULL_REQUEST_BRANCH -PdiffTo=$TRAVIS_BRANCH ; fi'
//
diffFrom . set(project . properties . diffFrom) // Can be empty (ignored), Git-commit or any Git-reference
diffTo . set(project . properties . diffTo) // Same as above
diffMinSeverity . set(se . bjurr . violations . lib . model . SEVERITY . INFO ) // INFO, WARN or ERROR
diffDetailLevel . set( se.bjurr.violations.git.ViolationsReporterDetailLevel . VERBOSE ) // PER_FILE_COMPACT, COMPACT or VERBOSE
diffMaxViolations . set( 99 ) // Will fail the build if number of violations, in the diff within from/to, is higher
diffPrintViolations . set( true ) // Will print violations found in diff
gitRepo . set(file( ' . ' )) // Where to look for Git
//
// This is mandatory regardless of if you want to report violations between
// revisions or the entire repo.
//
// Many more formats available, see: https://github.com/tomasbjerre/violations-lib
violationConfig()
.setFolder(projectDir . path)
.setParser( se.bjurr.violations.lib.reports.Parser . FINDBUGS )
.setPattern( " .*/findbugs/.* \ .xml $ " )
.setReporter( " Findbugs " )
violationConfig()
.setFolder(projectDir . path)
.setParser( se.bjurr.violations.lib.reports.Parser . PMD )
.setPattern( " .*/pmd/.* \ .xml $ " )
.setReporter( " PMD " )
}
check . finalizedBy violations