Repository Analysis

FuelLabs/sway

🌴 Empowering everyone to build reliable and efficient smart contracts.

4.0 Likely human-written View on GitHub
4.0
Adjusted Score
4.0
Raw Score
100%
Time Factor
2026-05-27
Last Push
61,660
Stars
Rust
Language
332,701
Lines of Code
4633
Files
972
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 21HIGH 1MEDIUM 43LOW 907

Pattern Findings

972 matches across 8 categories. Click a row to expand file-level details.

Over-Commented Block886 hits · 876 pts
SeverityFileLineSnippet
LOWci_checks.sh1#!/usr/bin/env bash
LOWforc/src/cli/shared.rs81 #[clap(flatten)]
LOWforc/src/cli/shared.rs101 /// Build target to use for code generation.
LOWforc/src/cli/shared.rs121 #[clap(long = "output-hexfile")]
LOWforc/src/cli/shared.rs141/// Dump options.
LOWforc/src/cli/shared.rs161 /// URL format to be used in the generated DCA graph .dot file.
LOWforc/src/cli/shared.rs181 #[clap(long)]
LOWforc/src/cli/shared.rs221/// Package-related options.
LOWforc/src/cli/shared.rs241 ///
LOWforc/src/cli/commands/test.rs21 [ Run test without any output => "forc test --silent" ]
LOWforc/src/cli/commands/test.rs41#[clap(bin_name = "forc test", version, after_help = help())]
LOWforc/src/cli/commands/test.rs61 /// These are the gas costs values of the Fuel mainnet as of time of
LOWforc/src/cli/commands/check.rs21pub struct Command {
LOWforc/src/cli/commands/build.rs21///
LOWforc/src/cli/commands/update.rs21
LOWforc/src/cli/commands/init.rs21 /// The default program type, excluding all flags or adding this flag creates a basic contract program.
LOWforc/src/cli/commands/new.rs21 /// program.
LOWforc/src/ops/forc_update.rs1use crate::cli::UpdateCommand;
LOWsway-parse/src/token.rs101 start: usize,
LOWsway-parse/src/parser.rs81 /// Tries to peek a `P` in its canonical way.
LOWsway-parse/src/parser.rs141
LOWtest/src/main.rs81 /// Print out the specified IR (separate options with comma), if the verbose option is on
LOWtest/src/main.rs121 ///
LOWtest/src/main.rs141 ///
LOWtest/src/in_language_tests/Forc.toml41"test_programs/storage_key_inline_tests",
LOWtest/src/in_language_tests/run_in_language_tests.sh1#!/usr/bin/env bash
LOWtest/src/snapshot/mod.rs601/// Iterate all instructions inside the DWARF file. For
LOWtest/src/sdk-harness/test_projects/storage_init/mod.rs21 .unwrap()
LOW…ess/test_projects/storage_vec_of_storage_string/mod.rs61// let _ = instance
LOW…ess/test_projects/storage_vec_of_storage_string/mod.rs81// .methods()
LOWtest/src/ir_generation/mod.rs41 /// // ::check-ir-optimized::
LOWtest/src/e2e_vm_tests/mod.rs1241 // However, "run_on_node" tests deploy contracts to a local node, and if multiple such tests
LOW…fail/match_expressions_struct_missing_fields/test.toml1category = "fail"
LOW…ould_fail/storage_in_library/test.dynamic_storage.toml1category = "fail"
LOW…test_programs/should_fail/storage_in_library/test.toml1category = "fail"
LOW…test_programs/should_fail/where_clause_impls/test.toml1category = "fail"
LOW…hould_fail/struct_field_privacy_field_access/test.toml1category = "fail"
LOW…hould_fail/struct_field_privacy_field_access/test.toml21#check: $()Private struct field is inaccessible
LOW…s/test_programs/should_fail/nested_functions/test.toml1category = "fail"
LOW…rams/should_fail/superabi_duplicate_methods6/test.toml1category = "fail"
LOW…programs/should_fail/variable_does_not_exist/test.toml1category = "fail"
LOW…programs/should_fail/variable_does_not_exist/test.toml21# check: $()let _ = x + y + z;
LOW…rams/should_fail/superabi_duplicate_methods8/test.toml1category = "fail"
LOW…s/should_fail/trait_method_generic_ambiguous/test.toml1category = "fail"
LOW…programs/should_fail/superabi_contract_call2/test.toml1category = "fail"
LOW…ould_fail/struct_field_privacy_instantiation/test.toml1category = "fail"
LOW…ould_fail/struct_field_privacy_instantiation/test.toml21#check: $()Struct "LibTwoPrivateFields" is declared here, and has private fields "y" and "z".
LOW…ould_fail/struct_field_privacy_instantiation/test.toml41#check: $()Inaccessible fields are "y" and "z".
LOW…ould_fail/struct_field_privacy_instantiation/test.toml61#check: $()z: u64,
LOW…ould_fail/struct_field_privacy_instantiation/test.toml81#check: $()let _ = LibStruct { nn: 0, x: 0 };
LOW…ould_fail/struct_field_privacy_instantiation/test.toml101#check: $()let _ = LibStruct { nn: 0, x: 0, y: 0, z: 0 };
LOW…ould_fail/struct_field_privacy_instantiation/test.toml121
LOW…ould_fail/struct_field_privacy_instantiation/test.toml141#check: $()Struct cannot be instantiated due to inaccessible private fields
LOW…ould_fail/struct_field_privacy_instantiation/test.toml161#check: $()Struct cannot be instantiated due to inaccessible private fields
LOW…ould_fail/struct_field_privacy_instantiation/test.toml181#nextln: $()Field "z" of the struct "LibStruct" is declared here as private.
LOW…ould_fail/struct_field_privacy_instantiation/test.toml201#nextln: $()Field "nn" does not exist in the struct "MainStruct".
LOW…e_field_access_on_non_struct/test.dynamic_storage.toml1category = "fail"
LOW…e_field_access_on_non_struct/test.dynamic_storage.toml21#check: $()Struct field does not exist
LOW…e_field_access_on_non_struct/test.dynamic_storage.toml41#check: $()Fields can only be accessed on storage variables that are structs.
LOW…ould_fail/storage_field_access_on_non_struct/test.toml1category = "fail"
826 more matches not shown…
Hallucination Indicators21 hits · 275 pts
SeverityFileLineSnippet
CRITICALtest/src/e2e_vm_tests/mod.rs938 pkg.built.descriptor.pinned.name.as_str(),
CRITICALtest/src/e2e_vm_tests/mod.rs962 pkg.built.descriptor.pinned.name.as_str(),
CRITICAL…e_field_access_on_non_struct/test.dynamic_storage.toml27#check: $()let _ = storage.s_01.second.x.prev_not_a_struct.read();
CRITICAL…e_field_access_on_non_struct/test.dynamic_storage.toml38#check: $()let _ = storage.s_01.second.third.x.prev_not_a_struct.read();
CRITICAL…e_field_access_on_non_struct/test.dynamic_storage.toml44#check: $()let _ = storage.s_01.second.third.non_existing_field.read();
CRITICAL…ould_fail/storage_field_access_on_non_struct/test.toml26#check: $()let _ = storage.s_01.second.x.prev_not_a_struct.read();
CRITICAL…ould_fail/storage_field_access_on_non_struct/test.toml37#check: $()let _ = storage.s_01.second.third.x.prev_not_a_struct.read();
CRITICAL…ould_fail/storage_field_access_on_non_struct/test.toml43#check: $()let _ = storage.s_01.second.third.non_existing_field.read();
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs694 prefixes: self_entry.inner.key.name.prefixes.clone(),
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs695 suffix: self_entry.inner.key.name.suffix.name.clone(),
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1176 prefixes: entry.inner.key.name.prefixes.clone(),
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1177 suffix: entry.inner.key.name.suffix.name.clone(),
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1230 prefixes: e.inner.key.name.prefixes.clone(),
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1231 suffix: e.inner.key.name.suffix.name.clone(),
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1236 && trait_type_args.len() == e.inner.key.name.suffix.args.len()
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1239 .zip(e.inner.key.name.suffix.args.iter())
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1327 prefixes: entry.inner.key.name.prefixes.clone(),
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1328 suffix: entry.inner.key.name.suffix.name.clone(),
CRITICALsway-core/src/semantic_analysis/namespace/trait_map.rs1332 .push((trait_call_path, entry.inner.key.name.suffix.args.clone()));
CRITICAL…ore/src/semantic_analysis/namespace/trait_coherence.rs68 let package_name = trait_entry.inner.key.name.prefixes.first().unwrap();
CRITICAL…ore/src/semantic_analysis/namespace/trait_coherence.rs179 let trait_name = trait_entry.inner.key.name.suffix.name.to_string();
Decorative Section Separators37 hits · 120 pts
SeverityFileLineSnippet
MEDIUM…ould_fail/struct_field_privacy_instantiation/test.toml106# ---------------------------------------------------
MEDIUM…ould_fail/struct_field_privacy_instantiation/test.toml183# ---------------------------------------------------
MEDIUM…ould_fail/struct_instantiation_type_mismatch/test.toml67# ----------------------------------------------------
MEDIUM…rograms/should_fail/array_invalid_index_type/test.toml61#---------------------------------------------------
MEDIUM…/test_programs/should_pass/storage_benchmarks/bench.sh23# ── Configurable constants ──────────────────────────────────────────
MEDIUM…/test_programs/should_pass/storage_benchmarks/bench.sh26# ────────────────────────────────────────────────────────────────────
MEDIUM…/test_programs/should_pass/storage_benchmarks/bench.sh28# ── Parse options ───────────────────────────────────────────────────
MEDIUM…/test_programs/should_pass/storage_benchmarks/bench.sh51# ── Helpers ─────────────────────────────────────────────────────────
MEDIUM…/test_programs/should_pass/storage_benchmarks/bench.sh100 # ── CSV output ──────────────────────────────────────────────────
MEDIUM…/test_programs/should_pass/storage_benchmarks/bench.sh111 # ── Histogram (optional) ─────────────────────────────────────────
MEDIUM…/test_programs/should_pass/storage_benchmarks/bench.sh161# ── Main ────────────────────────────────────────────────────────────
MEDIUM…t_programs/should_pass/storage_benchmarks/perf_diff.sh24# ── Argument validation ─────────────────────────────────────────────
MEDIUM…t_programs/should_pass/storage_benchmarks/perf_diff.sh49# ── Find matching commits ───────────────────────────────────────────
MEDIUM…t_programs/should_pass/storage_benchmarks/perf_diff.sh102# ── Parse benchmark data for a commit ───────────────────────────────
MEDIUM…t_programs/should_pass/storage_benchmarks/perf_diff.sh152# ── Collect data ────────────────────────────────────────────────────
MEDIUM…t_programs/should_pass/storage_benchmarks/perf_diff.sh182# ── Compute diffs and generate output ───────────────────────────────
MEDIUM…ms/should_pass/storage_benchmarks/bench_storage_vec.sh31# ── Configurable constants ──────────────────────────────────────────
MEDIUM…ms/should_pass/storage_benchmarks/bench_storage_vec.sh34# ────────────────────────────────────────────────────────────────────
MEDIUM…ms/should_pass/storage_benchmarks/bench_storage_vec.sh36# ── Parse options ───────────────────────────────────────────────────
MEDIUM…ms/should_pass/storage_benchmarks/bench_storage_vec.sh62# ── Helpers ─────────────────────────────────────────────────────────
MEDIUM…ms/should_pass/storage_benchmarks/bench_storage_vec.sh128 # ── CSV output ──────────────────────────────────────────────────
MEDIUM…ms/should_pass/storage_benchmarks/bench_storage_vec.sh175 # ── Histogram (optional) ─────────────────────────────────────────
MEDIUM…ms/should_pass/storage_benchmarks/bench_storage_vec.sh227# ── Main ────────────────────────────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh22# ── Size → type mapping ────────────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh42# ── Helpers ─────────────────────────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh104# ── Generate one project ───────────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh117 # ── Forc.toml ───────────────────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh134 # ── test.toml ───────────────────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh137 # ── src/main.sw ─────────────────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh152 # ── Empty-call baseline ──────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh158 # ── Populate baselines ──────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh169 # ── store_vec baselines ─────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh179 # ── Operation methods ───────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh207 # ── Test functions ──────────────────────────────────────────
MEDIUM…_pass/storage_benchmarks/generate_storage_vec_bench.sh257# ── Main ────────────────────────────────────────────────────────────
MEDIUM…rams/should_pass/storage_benchmarks/perf_diff_stats.sh16# ── Argument validation ─────────────────────────────────────────────
MEDIUM…rams/should_pass/storage_benchmarks/perf_diff_stats.sh38# ── Parse CSV and compute stats ─────────────────────────────────────
Verbosity Indicators16 hits · 27 pts
SeverityFileLineSnippet
LOWforc-pkg/src/manifest/mod.rs664 // While creating a `ManifestFile` we need to check if the given path corresponds to a
LOWforc-pkg/src/manifest/mod.rs682 // While creating a `ManifestFile` we need to check if the given path corresponds to a
LOWforc-pkg/src/manifest/mod.rs1092 // While creating a `ManifestFile` we need to check if the given path corresponds to a
LOWsway-core/src/asm_generation/fuel/register_allocator.rs584 // Step 1: Liveness Analysis.
LOWsway-core/src/asm_generation/fuel/register_allocator.rs587 // Step 2: Construct the interference graph.
LOWsway-core/src/asm_generation/fuel/register_allocator.rs591 // Step 3: Remove redundant MOVE instructions using the interference graph.
LOWsway-core/src/asm_generation/fuel/register_allocator.rs595 // Step 4: Simplify - i.e. color the interference graph and return a stack that contains
LOWsway-core/src/asm_generation/fuel/register_allocator.rs659 // Step 5: Use the stack to assign a register for each virtual register.
LOWsway-core/src/asm_generation/fuel/register_allocator.rs661 // Step 6: Update all instructions to use the resulting register pool.
LOWsway-core/src/ir_generation/function.rs1825 // Step 1: compile the user data and get its type
LOWsway-core/src/ir_generation/function.rs1839 // Step 2: build a struct with two fields:
LOWsway-core/src/ir_generation/function.rs1846 // Step 3: construct a local pointer for the message aggregate struct
LOWsway-core/src/ir_generation/function.rs1861 // Step 4: Convert the local variable into a value via `get_local`.
LOWsway-core/src/ir_generation/function.rs1868 // Step 5: Grab the message ID from `messages_types_map` and insert it as the
LOWsway-core/src/ir_generation/function.rs1890 // Step 6: Insert the user message data as the second field of the struct
LOWsway-core/src/type_system/info.rs1558 // TODO we need to check if this type has a custom AbiEncode impl or not
AI Slop Vocabulary5 hits · 14 pts
SeverityFileLineSnippet
MEDIUMforc/src/cli/commands/test.rs53 /// Number of threads to utilize when running the tests. By default, this is the number of
MEDIUMsway-core/src/asm_generation/from_ir.rs104 Stack(u64), // Storage in the runtime stack starting at an absolute word offset. Essentially a global.
MEDIUMsway-core/src/language/purity.rs6/// or could potentially access contract storage, it is [Purity::Impure]. If a function does not utilize any
MEDIUM…ysis/ast_node/expression/match_expression/typed/mod.rs162//! Essentially, we have to extract the variables exactly from the variant that has matched.
MEDIUMsway-ir/src/optimize/init_aggr_lowering.rs169 // Essentially, we are treating the nested `init_aggr` as a root for the rest of the lowerin
Example Usage Blocks5 hits · 8 pts
SeverityFileLineSnippet
LOW…/test_programs/should_pass/storage_benchmarks/bench.sh6# Usage:
LOW…t_programs/should_pass/storage_benchmarks/perf_diff.sh5# Usage:
LOW…ms/should_pass/storage_benchmarks/bench_storage_vec.sh14# Usage:
LOW…_pass/storage_benchmarks/generate_storage_vec_bench.sh5# Usage:
LOW…rams/should_pass/storage_benchmarks/perf_diff_stats.sh5# Usage:
Synthetic Comment Markers1 hit · 8 pts
SeverityFileLineSnippet
HIGH…emantic_analysis/ast_node/declaration/auto_impl/mod.rs1//! This module contains common infrastructure for generating and parsing auto-generated code.
Self-Referential Comments1 hit · 3 pts
SeverityFileLineSnippet
MEDIUMupdate_fuel_dependencies.sh11# Define the list of fuel maintained crates