Repository Analysis

google/magika

Fast and accurate AI powered file content types detection

4.8 Likely human-written View on GitHub
4.8
Adjusted Score
4.8
Raw Score
100%
Time Factor
2026-05-29
Last Push
17,064
Stars
Python
Language
52,142
Lines of Code
318
Files
237
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 0MEDIUM 4LOW 233

Pattern Findings

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

Hyper-Verbose Identifiers94 hits · 98 pts
SeverityFileLineSnippet
LOWpython/tests/test_features_extraction_vs_reference.py59def test_features_extraction_vs_reference(debug: bool = False) -> None:
LOWpython/tests/test_features_extraction_vs_reference.py81def test_reference_generation() -> None:
LOWpython/tests/test_features_extraction_vs_reference.py85def _generate_reference_features_extraction(test_mode: bool) -> None:
LOWpython/tests/test_features_extraction_vs_reference.py92def _dump_reference_features_extraction_examples(
LOWpython/tests/test_features_extraction_vs_reference.py114def _generate_reference_features_extraction_tests_cases() -> List[
LOWpython/tests/test_features_extraction_vs_reference.py145def _generate_reference_features_extraction_tests_cases_inputs() -> List[
LOWpython/tests/test_features_extraction_vs_reference.py211def _generate_content_from_metadata(
LOWpython/tests/test_features_extraction_vs_reference.py238def _get_examples_from_reference() -> List[FeaturesExtractionExample]:
LOWpython/tests/test_features_extraction_vs_reference.py253def _check_features_vs_reference_example_features(
LOWpython/tests/test_magika_python_module.py76def test_magika_module_with_basic_tests_by_paths() -> None:
LOWpython/tests/test_magika_python_module.py84def test_magika_module_with_basic_tests_by_path() -> None:
LOWpython/tests/test_magika_python_module.py94def test_magika_module_with_basic_tests_by_bytes() -> None:
LOWpython/tests/test_magika_python_module.py36def test_magika_module_check_version() -> None:
LOWpython/tests/test_magika_python_module.py50def test_magika_module_with_one_test_file() -> None:
LOWpython/tests/test_magika_python_module.py63def test_magika_module_with_explicit_model_dir() -> None:
LOWpython/tests/test_magika_python_module.py107def test_magika_module_with_basic_tests_by_stream() -> None:
LOWpython/tests/test_magika_python_module.py120def test_magika_module_with_all_models() -> None:
LOWpython/tests/test_magika_python_module.py131def test_magika_module_with_previously_missdetected_samples() -> None:
LOWpython/tests/test_magika_python_module.py140def test_magika_module_with_empty_content() -> None:
LOWpython/tests/test_magika_python_module.py170def test_magika_module_with_short_content() -> None:
LOWpython/tests/test_magika_python_module.py208def test_magika_module_with_python_and_non_python_content() -> None:
LOWpython/tests/test_magika_python_module.py225def test_magika_module_identify_stream_does_not_alter_position() -> None:
LOWpython/tests/test_magika_python_module.py245def test_magika_module_with_whitespaces() -> None:
LOWpython/tests/test_magika_python_module.py302def test_magika_module_with_different_prediction_modes() -> None:
LOWpython/tests/test_magika_python_module.py401def test_magika_module_overwrite_reason() -> None:
LOWpython/tests/test_magika_python_module.py470def test_magika_module_with_directory() -> None:
LOWpython/tests/test_magika_python_module.py483def test_magika_module_multiple_copies_of_the_same_file() -> None:
LOWpython/tests/test_magika_python_module.py499def test_magika_module_with_symlink() -> None:
LOWpython/tests/test_magika_python_module.py528def test_magika_module_with_non_existing_file() -> None:
LOWpython/tests/test_magika_python_module.py540def test_magika_module_with_permission_error() -> None:
LOWpython/tests/test_magika_python_module.py573def test_magika_module_with_really_many_files() -> None:
LOWpython/tests/test_magika_python_module.py588def test_magika_module_with_big_file() -> None:
LOWpython/tests/test_magika_python_module.py612def test_api_call_with_bad_types() -> None:
LOWpython/tests/test_magika_python_module.py645def test_access_magika_result_and_prediction():
LOWpython/tests/test_magika_python_module.py692def test_access_backward_compatibility_layer() -> None:
LOWpython/tests/test_magika_python_module.py721def test_get_model_and_output_content_types() -> None:
LOWpython/tests/test_magika_python_module.py795def get_expected_content_type_label_from_test_file_path(
LOWpython/tests/test_magika_python_module.py801def check_result_vs_expected_result(
LOWpython/tests/test_magika_python_module.py812def check_results_vs_expected_results(
LOWpython/tests/utils.py39def get_basic_tests_files_dir() -> Path:
LOWpython/tests/utils.py45def get_mitra_tests_files_dir() -> Path:
LOWpython/tests/utils.py51def get_previously_missdetected_files_dir() -> Path:
LOWpython/tests/utils.py57def get_basic_test_files_paths() -> List[Path]:
LOWpython/tests/utils.py63def get_mitra_test_files_paths() -> List[Path]:
LOWpython/tests/utils.py69def get_previously_missdetected_files_paths() -> List[Path]:
LOWpython/tests/utils.py75def get_reference_features_extraction_examples_path() -> Path:
LOWpython/tests/utils.py79def get_reference_for_inference_examples_by_path_path(model_name: str) -> Path:
LOWpython/tests/utils.py87def get_reference_for_inference_examples_by_content_path(model_name: str) -> Path:
LOWpython/tests/utils.py95def get_one_basic_test_file_path() -> Path:
LOWpython/tests/utils.py123def write_random_file_with_size(sample_path: Path, sample_size: int) -> None:
LOWpython/tests/utils.py177def get_imported_objects_after_wildcard() -> Dict[str, Any]:
LOWpython/tests/test_python_magika_client.py19def test_python_magika_client() -> None:
LOWpython/tests/test_inference_vs_reference.py63def test_inference_vs_reference(debug: bool = False) -> None:
LOWpython/tests/test_inference_vs_reference.py129def test_reference_generation() -> None:
LOWpython/tests/test_inference_vs_reference.py175def _generate_reference_for_inference(test_mode: bool) -> None:
LOWpython/tests/test_inference_vs_reference.py183def _generate_examples_by_path(
LOWpython/tests/test_inference_vs_reference.py226def _generate_examples_by_content(
LOWpython/tests/test_inference_vs_reference.py367def _dump_examples_by_content(
LOWpython/tests/test_inference_vs_reference.py476 def _get_cornern_case_example(
LOWpython/tests/test_inference_vs_reference.py526 def get_corner_case_candidates_generator(
34 more matches not shown…
Over-Commented Block92 hits · 92 pts
SeverityFileLineSnippet
LOWpython/tests/test_features_extraction_vs_reference.py1# Copyright 2024 Google LLC
LOWpython/tests/test_magika_python_module.py1# Copyright 2024 Google LLC
LOWpython/tests/utils.py1# Copyright 2024 Google LLC
LOWpython/tests/test_python_magika_client.py1# Copyright 2024 Google LLC
LOWpython/tests/test_inference_vs_reference.py1# Copyright 2024 Google LLC
LOWpython/scripts/sync.py1#!/usr/bin/env python3
LOWpython/scripts/sync.py121 python_model_dir = PYTHON_MODELS_DIR / model_name
LOWpython/scripts/sync.py181 + "\n"
LOWpython/scripts/check_copyright.py1# Copyright 2025 Google LLC
LOWpython/scripts/run_quick_test_magika_module.py1#!/usr/bin/env python
LOWpython/scripts/check_source.sh1#!/bin/bash
LOWpython/scripts/check_changelog.sh1#!/bin/bash
LOWpython/scripts/pre_release_check.py1# Copyright 2025 Google LLC
LOWpython/scripts/test_magika_model.py1#!/usr/bin/env python3
LOWpython/scripts/run_quick_test_magika_cli.py1#!/usr/bin/env python
LOWpython/scripts/generate_reference.py1# Copyright 2025 Google LLC
LOW…hon/scripts/prepare_pyproject_for_pure_python_wheel.py1# Copyright 2024 Google LLC
LOWpython/scripts/check_documentation.py1# Copyright 2025 Google LLC
LOWpython/src/magika/magika.py1# Copyright 2024 Google LLC
LOWpython/src/magika/__init__.py1# Copyright 2024 Google LLC
LOWpython/src/magika/logger.py1# Copyright 2024 Google LLC
LOWpython/src/magika/colors.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/prediction_mode.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/magika_error.py1# Copyright 2025 Google LLC
LOWpython/src/magika/types/content_type_info.py1# Copyright 2025 Google LLC
LOWpython/src/magika/types/__init__.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/model.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/content_type_label.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/overwrite_reason.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/magika_prediction.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/magika_result.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/seekable.py1# Copyright 2024 Google LLC
LOWpython/src/magika/types/strenum.py1# Copyright 2025 Google LLC
LOWpython/src/magika/types/status.py1# Copyright 2024 Google LLC
LOWpython/src/magika/cli/magika_client.py1#!/usr/bin/env python3
LOW…src/magika/cli/magika_rust_client_not_found_warning.py1#!/usr/bin/env python
LOWjs/magika-cli.ts1#! /usr/bin/env node
LOWjs/magika-node.ts1// Copyright 2024 Google LLC
LOWjs/magika.ts1// Copyright 2024 Google LLC
LOWjs/test/tfnHook.ts1// Copyright 2024 Google LLC
LOWjs/test/magika-cli.test.ts1// Copyright 2024 Google LLC
LOWjs/test/inference-vs-reference.test.ts1// Copyright 2024 Google LLC
LOWjs/test/utils.ts1// Copyright 2024 Google LLC
LOWjs/test/features-extraction-vs-reference.test.ts1// Copyright 2024 Google LLC
LOWjs/test/magika.test.ts1// Copyright 2024 Google LLC
LOWjs/src/model-prediction.ts1// Copyright 2024 Google LLC
LOWjs/src/content-type-info.ts1// Copyright 2024 Google LLC
LOWjs/src/status.ts1// Copyright 2024 Google LLC
LOWjs/src/magika-prediction.ts1// Copyright 2024 Google LLC
LOWjs/src/model-node.ts1// Copyright 2024 Google LLC
LOWjs/src/magika-result.ts1// Copyright 2024 Google LLC
LOWjs/src/overwrite-reason.ts1// Copyright 2024 Google LLC
LOWjs/src/model.ts1// Copyright 2024 Google LLC
LOWjs/src/content-types-infos.ts1// Copyright 2024 Google LLC
LOWjs/src/prediction-mode.ts1// Copyright 2024 Google LLC
LOWjs/src/magika-options.ts1// Copyright 2024 Google LLC
LOWjs/src/content-type-label.ts1// Copyright 2024 Google LLC
LOWjs/src/model-config-node.ts1// Copyright 2024 Google LLC
LOWjs/src/model-features.ts1// Copyright 2024 Google LLC
LOWjs/src/model-config.ts1// Copyright 2024 Google LLC
32 more matches not shown…
Unused Imports28 hits · 28 pts
SeverityFileLineSnippet
LOWpython/tests/test_features_extraction_vs_reference.py15
LOWpython/tests/test_inference_vs_reference.py15
LOWpython/scripts/check_documentation.py18
LOWpython/src/magika/__init__.py20
LOWpython/src/magika/__init__.py21
LOWpython/src/magika/__init__.py22
LOWpython/src/magika/__init__.py23
LOWpython/src/magika/__init__.py24
LOWpython/src/magika/__init__.py25
LOWpython/src/magika/__init__.py26
LOWpython/src/magika/__init__.py27
LOWpython/src/magika/__init__.py28
LOWpython/src/magika/logger.py17
LOWpython/src/magika/types/prediction_mode.py17
LOWpython/src/magika/types/__init__.py18
LOWpython/src/magika/types/__init__.py19
LOWpython/src/magika/types/__init__.py20
LOWpython/src/magika/types/__init__.py21
LOWpython/src/magika/types/__init__.py22
LOWpython/src/magika/types/__init__.py23
LOWpython/src/magika/types/__init__.py23
LOWpython/src/magika/types/__init__.py23
LOWpython/src/magika/types/__init__.py28
LOWpython/src/magika/types/__init__.py29
LOWpython/src/magika/types/__init__.py30
LOWpython/src/magika/types/__init__.py31
LOWpython/src/magika/types/magika_prediction.py17
LOWpython/src/magika/types/strenum.py26
Fake / Example Data7 hits · 9 pts
SeverityFileLineSnippet
LOWtests_data/basic/txt/lorem-small.txt2Lorem ipsum dolor sit amet, consectetur adipiscing elit. Collatio igitur ista te nihil iuvat. Honesta oratio, Socratica,
LOWtests_data/basic/txt/lorem-small.txt2Lorem ipsum dolor sit amet, consectetur adipiscing elit. Collatio igitur ista te nihil iuvat. Honesta oratio, Socratica,
LOWtests_data/basic/txt/lorem-big.txt1Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquam dui sit amet justo eleifend ullamcorper. Class
LOWtests_data/basic/txt/lorem-big.txt1Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquam dui sit amet justo eleifend ullamcorper. Class
LOWtests_data/basic/txt/lorem-big.txt7Ut eleifend lectus et ullamcorper interdum. Sed laoreet, quam at placerat viverra, ipsum erat rhoncus dolor, sit amet el
LOWtests_data/basic/txt/lorem-big.txt7Ut eleifend lectus et ullamcorper interdum. Sed laoreet, quam at placerat viverra, ipsum erat rhoncus dolor, sit amet el
LOWtests_data/basic/markdown/simple.md9Lorem ipsum?
Excessive Try-Catch Wrapping5 hits · 7 pts
SeverityFileLineSnippet
MEDIUMpython/CHANGELOG.md82 print(f"Error: {result.status}")
LOWpython/scripts/pre_release_check.py81 except Exception:
LOWpython/scripts/pre_release_check.py174 except Exception:
LOWpython/scripts/run_quick_test_magika_cli.py52 except Exception as e:
MEDIUMwebsite-ng/src/content/docs/cli-and-bindings/python.md92... print(f"Error: {result.status.message}")
Deep Nesting7 hits · 7 pts
SeverityFileLineSnippet
LOWpython/scripts/run_quick_test_magika_module.py35
LOWpython/scripts/pre_release_check.py147
LOWpython/scripts/run_quick_test_magika_cli.py37
LOWpython/scripts/check_documentation.py163
LOWpython/scripts/check_documentation.py220
LOWpython/src/magika/magika.py578
LOWpython/src/magika/cli/magika_client.py133
Self-Referential Comments2 hits · 6 pts
SeverityFileLineSnippet
MEDIUMpython/src/magika/magika.py588 # The following code checks whether the score is "high enough", where
MEDIUM.github/workflows/cli-release.yml270 # Create a GitHub Release while uploading all files to it
Redundant / Tautological Comments2 hits · 3 pts
SeverityFileLineSnippet
LOWpython/scripts/pre_release_check.py166 # Check if it is a python script
LOWpython/src/magika/magika.py234 # Check if we would overwrite this target label; if not, use the