Skip to main content

File-by-file analysis

The following sections describe the steps for the File-by-file Analysis method,
Which appears when you choose file by file analysis.

It is done in two sequential steps:

  • File filtering: select which files and folders to include in the analysis
  • Content filtering: further refine the selected files by analyzing their contents

NOTE: Both filters are combined. Artemis will only include files that pass both filters.


Step 1: File filtering — select the code files to analyse

Under File Filtering, you can choose which code files to include or exclude. This can be done in two ways:

  • Option 1: File filtering via File Explorer (manual selection)
    File selection

  • Option 2: File filtering via Glob patterns (automatic selection). You can include or exclude files based on their file names using glob patterns.
    Regex selection

Accepted file formats
LanguageFile Extensions
C++.cpp, .c, .h, .hpp, .cc, .hh, .cxx, .hxx, .c++, .h++, .cu, .cuh
C.c, .h
Java.java
Python.py
Fortran.f, .for, .f90, .f95, .f03, .f08, .F, .F90
JavaScript.js, .jsx
TypeScript.ts, .tsx
Ruby.rb
PHP.php
C#.cs
Go.go
Swift.swift
Kotlin.kt, .kts
Scala.scala
Rust.rs
Dart.dart
R.r, .R
Lua.lua
Perl.pl, .pm
SQL.sql
Q.q
COBOL.cob, .cbl, .cpy
OCaml.ml
Elixir.ex
Text.txt, .md, .html, .css, .scss, .vue, .xml, .json, .yaml, .yml, .ini, .log, .conf, .cfg, .tsv, .rst, .tex, .bat, .sh, .pl, .toml, .properties, .gradle, .maven, .cmd, .awk, .env, .helm, .tpl, .kubeconfig, .npmrc, .prettierrc, .eslintrc, .babelrc, .terraformrc, .tfvars, .tf, .editorconfig, .gitignore, .gitconfig, .zshrc, .bashrc, .profile, .flake8, .pylintrc, .coveragerc, .drl, .m, .jl, .vba, .bas, .cls, .frm
Unsupported.csv

Step 2: Content filtering — filter files by content and split large files

Under Content Filtering, you can refine the selection further based on file contents.

Content filtering

  • You can split large files by class or function. Each part will be extracted as a separate target.
  • Options: Function, Class, or File (entire file).
  • Click Expand for content filters for additional filtering options.

Content filtering: Advanced options

Advanced filtering can be done using:

  • Regular expressions
  • Size
  • Tree-sitter structure

Content filtering expand options

Regex logic

The Advanced Query Options section only contains condition, criteria, and value fields, but filtering logic also depends on the code language and object dropdowns at the top. Each example below shows a complete query.

  1. Regular expressions

    • Specify whether content should match or not match a regex.

    • Example:
      Regex-based filtering

      Example query

      Cpp Function matches regular expression \bSumPrimes\s*\(

  2. Size-based filtering

    • Filter content based on size (characters, words, or lines).

    • Example:
      Size-based filtering

      Example query

      Cpp Class has size >= 10 lines

  3. Tree-sitter structure

    • Extract code structures such as loop or nested_loop.

    • Example:
      Treesitter-based filtering

      Example query

      Cpp Function contains treesitter structure nested_loop

For more details, see the Tree-sitter library.


Content filtering with LLM

You can also filter code with an LLM query.

  • Enable the LLM Filtering toggle.
    LLM-based filtering
  • Optionally, set target count to limit how many targets are selected (e.g., 5 = top 5 inefficient files).
LLMs are not perfect

LLM-based filtering may produce false positives (targets that cannot actually be optimized).


View targets

After analysis, Artemis extracts targets according to your filters and shows them in the targets tab.

Next steps:

  • Evaluate target quality using Artemis scoring. See Code Scoring.
  • Index your code for better context-aware suggestions. See Code Indexing.