Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# Codacy Rules
Configuration for AI behavior when interacting with Codacy's MCP Server

## After ANY successful `edit_file` or `reapply` operation
- YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with:
- `rootPath`: set to the workspace path

Check notice on line 7 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L7

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- `file`: set to the path of the edited file

Check notice on line 8 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L8

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- `tool`: leave empty or unset

Check notice on line 9 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L9

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- If any issues are found in the new edits, propose and apply fixes for them.
- > NOTE: Failure to follow this rule is considered a critical error.

## CRITICAL: Dependencies and Security Checks
- IMMEDIATELY after ANY of these actions:
- Running npm/yarn/pnpm install

Check notice on line 15 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L15

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Adding dependencies to package.json

Check notice on line 16 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L16

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Adding requirements to requirements.txt

Check notice on line 17 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L17

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Adding dependencies to pom.xml

Check notice on line 18 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L18

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Adding dependencies to build.gradle

Check notice on line 19 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L19

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Any other package manager operations

Check notice on line 20 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L20

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- You MUST run the `codacy_cli_analyze` tool with:
- `rootPath`: set to the workspace path
- `tool`: set to "trivy"

Check notice on line 23 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L23

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- `file`: leave empty or unset

Check notice on line 24 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L24

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- If any vulnerabilities are found because of the newly added packages:
- Stop all other operations

Check notice on line 26 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L26

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Propose and apply fixes for the security issues

Check notice on line 27 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L27

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Only continue with the original task after security issues are resolved

Check notice on line 28 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L28

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- EXAMPLE:
- After: npm install react-markdown

Check notice on line 30 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L30

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Do: Run codacy_cli_analyze with trivy

Check notice on line 31 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L31

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space
- Before: Continuing with any other tasks

Check notice on line 32 in .github/copilot-instructions.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/copilot-instructions.md#L32

[list-item-bullet-indent] Incorrect indentation before bullet: remove 1 space

## General
- Repeat the relevant steps for each modified file.
- "Propose fixes" means to both suggest and, if possible, automatically apply the fixes.
- You MUST NOT wait for the user to ask for analysis or remind you to run the tool.
- Do not run `codacy_cli_analyze` looking for changes in duplicated code or code complexity metrics.
- Do not run `codacy_cli_analyze` looking for changes in code coverage.
- Do not try to manually install Codacy CLI using either brew, npm, npx, or any other package manager.
- If the Codacy CLI is not installed, just run the `codacy_cli_analyze` tool from Codacy's MCP Server.
- When calling `codacy_cli_analyze`, only send provider, organization and repository if the project is a git repository.

## Whenever a call to a Codacy tool that uses `repository` or `organization` as a parameter returns a 404 error
- Offer to run the `codacy_setup_repository` tool to add the repository to Codacy
- If the user accepts, run the `codacy_setup_repository` tool
- Do not ever try to run the `codacy_setup_repository` tool on your own
- After setup, immediately retry the action that failed (only retry once)
---
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ object BlacklistDocTransformer extends IPatternDocTransformer {
Level.Warn,
Pattern.Category.Security,
SecuritySubcategories.get(patternIdCapitalized),
Some(Pattern.ScanType.SAST),
Set.empty,
Set.empty,
enabled = DefaultPatterns.list.contains(patternIdCapitalized.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import docs.transformers.utils.HtmlLoader

import scala.xml._
import better.files._
import com.codacy.plugins.api.results.Pattern.Category
import com.codacy.plugins.api.results.Pattern.{Category, Scantype}
import com.codacy.plugins.api.results.Result.Level
import com.codacy.plugins.api.results.Pattern
import docs.{DefaultPatterns, SecuritySubcategories}
Expand Down Expand Up @@ -52,7 +52,7 @@ object PluginsDocTransformer extends IPatternDocTransformer {
divs <- htmlPluginsDocs
if (divs \@ "id").startsWith(patternId.value.toLowerCase())
divsChildren <- divs.child.filter { node =>
val l = node.labels
val l = node.label
l == "h1" || l == "h2" || l == "p"
}
} yield divsChildren
Expand Down Expand Up @@ -80,6 +80,8 @@ object PluginsDocTransformer extends IPatternDocTransformer {
severity,
Category.Security,
SecuritySubcategories.get(patternIdCapitalized),
Some(ScanType.SAST),
Set.empty,
Set.empty,
enabled = DefaultPatterns.list.contains(patternIdCapitalized.value)
)
Expand Down
162 changes: 162 additions & 0 deletions docs/description/B613.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading