Code Inspector Documentation

Code Inspector Documentation

  • Getting Started
  • Integration
  • API
  • FAQ

›Metrics and Dashboard

Getting Started

  • Getting Started
  • Create Account
  • Create Group
  • Create Project
  • Add a Badge
  • Automated Codefix

Metrics and Dashboard

  • List of Metrics
  • Analysis Results
  • Project Dashboard
  • Technical Debt Estimates
  • Dependencies

Configuration

  • Project preferences
  • Ignore Files and Violations
  • Branch Support

Pricing and Billing

  • Pricing
  • Billing

List of Metrics

This page lists all metrics detected by Code Inspector engine.

Code Violation (aka Code Smell)

A code violation is a piece of code that is not correct. Some errors are not so important (most of the code style errors, which makes it difficult to read - and sometimes understand - the source code) but others (such as security errors like a buffer overflow) are very important.

To help Code Inspector users know what violations should be fixed, the engines differentiate them using categories and severities.

Categories

Code Inspector classifies code violations into the following categories:

  • Best Practice: the code is not following the language best practice (e.g. common function to use, avoid printing the stack trace, do not reassign parameters, etc).
  • Code Style: potential syntax error or language-specific coding style (e.g. correct casing, varible names, etc.), not critical but something that can facilitate maintenance.
  • Documentation: any documentation issues (e.g. function is not documented or parameters documentaition are missing). Low impact on your technical debt (but something to keep in mind for maintenance purposes). Low impact on technical debt.
  • Design: potential design issues in classes or functions (e.g. number of parameters, functions are too long, etc). High impact on technical debt.
  • Deployment: any issue regarding deployment (e.g. deployment script in AWS, etc.). Medium to high impact on technical debt.
  • Error Prone: any statement that can be confusing and impact software maintenance (e.g. comparison issue, statements without any effect). Medium impact on technical debt.
  • Performance: code that negatively impacts your performance (e.g. inefficient code). High impact on technical debt.
  • Security: code that might introduce a buffer overflow or any other security issues. High impact on technical debt.
  • Safety: code that might crash. High impact on technical debt.
  • Unknown

Severity

Code Inspector seperates violations into four severity, from 1 (critical) to 4 (minor). Violations with the highest priorities should be the one to be prioritized over low priority.

Duplicates

Code should not be duplicated and instead, developers should refactor duplicated code into function. When writing code, developers should follow the DRY (Do not Repeat Yourself) principle.

Code inspector detects code duplicates automatically. Code Inspector considers a block of code is a duplicate if they share more than 10 similar lines. This value can be tuned in the project preferences.

Complex Functions

Complex functions are hard to understand, which makes them more prone to bugs and more difficult to maintain. Code Inspector uses the Cyclomatic Complexity metric to detect complex code. Any function with a cyclomatic complexity higher than 25 is classified as complex and should be refactored.

Long Functions

Long functions are difficult to read and, as for complex functions, prone to errors and hard to maintain. For that reason, they should be replaced by shorter functions, which are easier to read, understand and test.

Code Inspector considers that any function longer than 40 lines is too long and should be refactored into smaller unit of code.

← Automated CodefixAnalysis Results →
  • Code Violation (aka Code Smell)
    • Categories
    • Severity
  • Duplicates
  • Complex Functions
  • Long Functions
Code Inspector Documentation
Docs
Getting StartedIntegrationsAPI Reference
Community
SlackTwitter
More
Medium
Follow @code_inspector
Copyright © 2021 XCoding labs, LLC