{"record":{"id":"e1dd475f363446ce","repo":"slint-ui/slint","slug":"missing-tag","errorCode":null,"errorMessage":"Missing tag","messagePattern":"Missing tag","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/license_headers_check.rs","lineNumber":982,"sourceCode":"            Err(anyhow!(\"Encountered one or multiple errors. See above for details.\").into())\n        } else {\n            println!(\"All files are ok.\");\n            Ok(())\n        }\n    }\n\n    fn check_file_tags(&self, path: &Path, style: &LicenseTagStyle, license: &str) -> Result<()> {\n        let source = &std::fs::read_to_string(path).context(\"Error reading file\")?;\n\n        let source = SourceFileWithTags::new(source, style);\n\n        if !source.has_tag() {\n            if self.fix_it {\n                eprintln!(\"Fixing up {path:?} as instructed. It's missing a license header.\");\n                let source = source.replace_tag(&EXPECTED_HEADER, license);\n                std::fs::write(path, source).context(\"Error writing source\")\n            } else {\n                Err(anyhow!(\"Missing tag\"))\n            }\n        } else if source.tag_matches(&EXPECTED_HEADER, license) {\n            Ok(())\n        } else if self.fix_it {\n            eprintln!(\"Fixing up {path:?} as instructed. It has a wrong license header.\");\n            let source = source.replace_tag(&EXPECTED_HEADER, license);\n            std::fs::write(path, source).context(\"Error writing new source\")\n        } else {\n            Err(anyhow!(\n                \"unexpected header.\\nexpected: {}\\nfound: {}\",\n                EXPECTED_HEADER.to_string(style, license),\n                source.found_tag()\n            ))\n        }\n    }\n\n    fn check_cargo_toml(&self, path: &Path, license: &str) -> Result<()> {\n        let mut doc = CargoToml::new(path)?;","sourceCodeStart":964,"sourceCodeEnd":1000,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/xtask/src/license_headers_check.rs#L964-L1000","documentation":"check_file_tags throws \"Missing tag\" when a source file has no license header tag at all and the check runs without --fix. The check expects every source file to begin with the standard Slint SPDX/license header comment.","triggerScenarios":"Adding a new .rs/.slint/.cpp file without copying the license header; running `cargo xtask check` (no --fix) so the auto-fix branch (which would insert EXPECTED_HEADER) is skipped.","commonSituations":"Newly created files by IDE templates; generated files copied into the repo; contributors unaware of the header requirement.","solutions":["Run `cargo xtask check --fix` which prepends the expected license header automatically","Copy the standard license header from another file at the top of the file","Confirm the file isn't excluded from the check if it's generated or vendored"],"exampleFix":"// before (top of file)\nfn main() {}\n// after\n// Copyright © SixtyFPS GmbH <info@slint.dev>\n// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-commercial\n\nfn main() {}","handlingStrategy":"validation","validationCode":"const HEADER: &str = \"// Copyright © SixtyFPS GmbH <info@slint.dev>\\n// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-commercial\";\nlet src = std::fs::read_to_string(path)?;\nif !src.starts_with(\"// Copyright\") {\n    panic!(\"{path}: missing license header\");\n}","typeGuard":"fn has_license_header(src: &str) -> bool {\n    src.trim_start().starts_with(\"// Copyright\")\n        && src.contains(\"SPDX-License-Identifier:\")\n}","tryCatchPattern":null,"preventionTips":["Configure your editor/IDE file templates to insert the license header on new files","Copy an existing file as a starting point when adding new sources","Run `cargo xtask check` before committing new files","Register the header in tools like cargo-new templates or snippets"],"tags":["license","spdx","header","ci"],"backgroundTag":"missing-required-flag","analyzedSha":"3a7e700487dc74d404cad0726378053ab763d4e0","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}