{"title":"CodeCop Warning AA0228","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/codecop-aa0228/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop-aa0228, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop-aa0228","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"The local method must be used, otherwise the method is not necessary.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"CodeCop Warning AA0228","slug":"codecop-warning-aa0228","at":0,"chars":935},{"level":2,"title":"Description","slug":"description","at":75,"chars":85},{"level":2,"title":"Reason for the rule","slug":"reason-for-the-rule","at":160,"chars":110},{"level":2,"title":"Bad code example","slug":"bad-code-example","at":270,"chars":256},{"level":2,"title":"Good code example","slug":"good-code-example","at":526,"chars":180},{"level":2,"title":"Good and bad practices for fixing the rule","slug":"good-and-bad-practices-for-fixing-the-rule","at":706,"chars":92},{"level":2,"title":"Related information","slug":"related-information","at":798,"chars":137}],"text":"# CodeCop Warning AA0228\nThe local method must be used; otherwise removed.\n## Description\nThe local method must be used, otherwise the method is not necessary.\n## Reason for the rule\nUnused methods can be confusing for the reader and can cost performance to the system.\n## Bad code example\n```al\ncodeunit 10 MyCodeunit\n{\n    var\n       RenameErr: Label 'You cannot rename';\n\n    local procedure Method1()\n    begin\n       Message(RenameErr);\n    end;\n\n    procedure Method2()\n    begin\n       Error(RenameErr);\n    end;\n}\n```\n## Good code example\n```al\ncodeunit 10 MyCodeunit\n{\n    var\n       RenameErr: Label 'You cannot rename';\n\n    procedure Method2()\n    begin\n       Error(RenameErr);\n    end;\n}\n```\n## Good and bad practices for fixing the rule\nRemove the unused local method from the code.\n## Related information\nCodeCop Analyzer<codecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}