{"id":13783900,"url":"https://github.com/code-cracker/code-cracker","last_synced_at":"2025-05-14T08:07:35.859Z","repository":{"id":22947209,"uuid":"26296658","full_name":"code-cracker/code-cracker","owner":"code-cracker","description":"An analyzer library for C# and VB that uses Roslyn to produce refactorings, code analysis, and other niceties.","archived":false,"fork":false,"pushed_at":"2024-02-13T22:18:31.000Z","size":3800,"stargazers_count":1131,"open_issues_count":146,"forks_count":279,"subscribers_count":112,"default_branch":"master","last_synced_at":"2025-04-14T03:57:41.236Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"http://code-cracker.github.io/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code-cracker.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-07T00:31:47.000Z","updated_at":"2025-04-09T06:20:02.000Z","dependencies_parsed_at":"2023-01-13T22:30:11.462Z","dependency_job_id":"6f78f059-27f5-4213-a445-83ebce71e520","html_url":"https://github.com/code-cracker/code-cracker","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-cracker%2Fcode-cracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-cracker%2Fcode-cracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-cracker%2Fcode-cracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-cracker%2Fcode-cracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code-cracker","download_url":"https://codeload.github.com/code-cracker/code-cracker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101557,"owners_count":22014908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-08-03T19:00:32.734Z","updated_at":"2025-05-14T08:07:34.250Z","avatar_url":"https://github.com/code-cracker.png","language":"C#","funding_links":[],"categories":["hacktoberfest","Deprecated Analyzers","Open Source Analyzers, Code Fixes, and Refactorings"],"sub_categories":["Miscellaneous"],"readme":"# Code Cracker\n\nAn analyzer library for C# and VB that uses [Roslyn](https://github.com/dotnet/roslyn) to produce refactorings, code analysis, and other niceties. \n\nCheck the official project site on [code-cracker.github.io](http://code-cracker.github.io). There you will find information on how to contribute,\nour task board, definition of done, definition of ready, etc.\n\n[![Build status](https://ci.appveyor.com/api/projects/status/h21sli3jkumuswyi?svg=true)](https://ci.appveyor.com/project/code-cracker/code-cracker)\n[![Nuget count](https://img.shields.io/nuget/v/codecracker.CSharp.svg)](https://www.nuget.org/packages/codecracker.CSharp/)\n[![License](https://img.shields.io/github/license/code-cracker/code-cracker.svg)](https://github.com/code-cracker/code-cracker/blob/master/LICENSE.txt)\n[![Issues open](https://img.shields.io/github/issues-raw/code-cracker/code-cracker.svg)](https://huboard.com/code-cracker/code-cracker/)\n[![Coverage Status](https://img.shields.io/coveralls/code-cracker/code-cracker/master.svg)](https://coveralls.io/r/code-cracker/code-cracker?branch=master)\n[![Source Browser](https://img.shields.io/badge/Browse-Source-green.svg)](http://ccref.azurewebsites.net)\n\nYou can find this document in the following languages\n\n[![English](https://img.shields.io/badge/language-english-blue.svg)](https://github.com/code-cracker/code-cracker/blob/master/README.md)\n[![Brazilian Portuguese](https://img.shields.io/badge/language-brazilan%20portuguese-brightgreen.svg)](https://github.com/code-cracker/code-cracker/blob/master/README.pt.md)\n\n\nThis is a community project, free and open source. Everyone is invited to contribute, fork, share and use the code. No money shall be charged by this \nsoftware, nor it will be. Ever.\n\n## Features\n\nThe list of features is documented here: http://code-cracker.github.io/diagnostics.html\n\n#### Design\nCode | Analyzer | Severity | Description \n-- | -- | -- | --\n[CC0003](http://code-cracker.github.io/diagnostics/CC0003.html) | CatchEmptyAnalyzer | Warning | Catch statements with no Exception as an argument is not recommended. Consider adding an Exception class to the catch statement.\n[CC0004](http://code-cracker.github.io/diagnostics/CC0004.html) | EmptyCatchBlockAnalyzer | Warning | An empty catch block suppress all errors and shouldn’t be used. If the error is expected consider logging it or changing the control flow such that it is explicit.\n[CC0016](http://code-cracker.github.io/diagnostics/CC0016.html) | CopyEventToVariableBeforeFireAnalyzer | Warning | Events should always be checked for null before being invoked. As in a multi-threading context, it is possible for an event to be unsubscribed between the moment where it is checked to be non-null and the moment it is raised, the event must be copied to a temporary variable before the check.\n[CC0021](http://code-cracker.github.io/diagnostics/CC0021.html) | NameOfAnalyzer | Warning | In C#6 the nameof() operator should be used to specify the name of a program element instead of a string literal as it produces code that is easier to refactor.\n[CC0024](http://code-cracker.github.io/diagnostics/CC0024.html) | StaticConstructorExceptionAnalyzer | Warning | Static constructor are called before the first time a class is used but the caller doesn’t control when exactly. Exceptions thrown in this context force callers to use ‘try’ block around any usage of the class and should be avoided.\n[CC0031](http://code-cracker.github.io/diagnostics/CC0031.html) | UseInvokeMethodToFireEventAnalyzer | Warning | In C#6 a delegate can be invoked using the null-propagating operator (?.) and its invoke method to avoid throwing a NullReference exception when there is no method attached to the delegate.\n\n## Installing\n\nYou may use CodeCracker in two ways: as an analyzer library that you install with NuGet into your project, or as a Visual Studio extension.\nThe way you want to use it depends on the scenario you are working on. You most likely want the Nuget package.\n\nIf you want the analyzers to work during your build, and generate warnings and errors during the build, also on build servers, then you want\nto use the Nuget package. The package is available on NuGet ([C#](https://www.nuget.org/packages/codecracker.CSharp),\n[VB](https://www.nuget.org/packages/codecracker.VisualBasic)).\nIf you want to be able to configure which analyzers are being used in your project, and which ones you will ignore, and commit those\nchanges to source control and share with your team, then you also want the Nuget package.\n\nTo install from NuGet, for the C# version:\n\n```powershell\nInstall-Package CodeCracker.CSharp\n```\n\nOr for the Visual Basic version:\n\n```powershell\nInstall-Package CodeCracker.VisualBasic\n```\n\nOr use the Package Manager in Visual Studio.\n\nThere is also a version for both named `CodeCracker` only, but it makes no sense to get it, you should search for the C# or VB version.\n\nIf you want the alpha builds that build on each push to the repo, add [this](https://www.myget.org/F/codecrackerbuild/) to your NuGet feed.\nWe only push complete releases to Nuget.org, and commit builds go to Myget.org.\n\nIf you want global analyzers that will work on every project you open in Visual Studio, then you want the Extension.\nGrab the extension at the Visual Studio Extensions Gallery ([C#](https://visualstudiogallery.msdn.microsoft.com/ab588981-91a5-478c-8e65-74d0ff450862),\n[VB](https://visualstudiogallery.msdn.microsoft.com/1a5f9551-e831-4812-abd0-ac48603fc2c1)).\n\nTo build from source:\n\n```shell\ngit clone https://github.com/code-cracker/code-cracker.git\ncd CodeCracker\nmsbuild\n```\n\nThen add a reference to CodeCracker.dll from within the Analyzers node inside References, in Visual Studio.\n\nTL;DR:\nIf you want to use CodeCracker in all your projects, install the Visual Studio extension ([C#](https://visualstudiogallery.msdn.microsoft.com/ab588981-91a5-478c-8e65-74d0ff450862), [VB](https://visualstudiogallery.msdn.microsoft.com/1a5f9551-e831-4812-abd0-ac48603fc2c1)). If you want to use CodeCracker for just one project, install the Nuget package as described above.\n\n## SonarQube Plugin\n\nCodeCracker has a SonarQube Plugin that can be downloaded at [Plugins HomePage](http://docs.sonarqube.org/display/PLUG/Other+Plugins).\n\n## Contributing [![Open Source Helpers](https://www.codetriage.com/code-cracker/code-cracker/badges/users.svg)](https://www.codetriage.com/code-cracker/code-cracker)\n\nThe main supported IDE for development is Visual Studio 2017.\nWe do not support VS 2015 anymore.\n\nQuestions, comments, bug reports, and pull requests are all welcome.\nBug reports that include steps to reproduce (including code) are\npreferred. Even better, make them in the form of pull requests.\nBefore you start to work on an existing issue, check if it is not assigned\nto anyone yet, and if it is, talk to that person.\nAlso, check the project [board](https://huboard.com/code-cracker/code-cracker/)\nand verify it is not being worked on (it will be tagged with the `Working` tag).\nIf it is not being worked on, check if the item is `Ready` before you start.\nIf the issue has the `Working` tag (working swimlane on Huboard) and has no Assignee\nthen it is not being worked on by somebody on the core team. Check the issue's\ndescription to find out who it is (if it is not there it has to be on the comments).\nWe are adding people that want to contribute to the `Contributors` team so we can\nalways assign them to the issues, so during your first contribution you probably will\nbe assigned to this team.\n\nThe easiest way to start is looking into the issues that are\n[up for grabs](https://github.com/code-cracker/code-cracker/labels/up-for-grabs). You\nmay ask to work on any of them, read below to see how. You can also triage issues which may include reproducing bug reports or asking for vital information such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to code-cracker on CodeTriage](https://www.codetriage.com/code-cracker/code-cracker).\n\nIf you are just starting with Roslyn, want to contribute, and feel you are not yet ready\nto start working on full analyzers or code fixes, you can start helping with areas that are\nless demanding. We have identified a few:\n\n* Fixing bugs\n\n  Still demands knowledge of Roslyn internals but it is easier than coming up with a full analyzer or code fix. Look for the [bugs that are up for grabs](https://github.com/code-cracker/code-cracker/issues?utf8=%E2%9C%93\u0026q=is%3Aopen+label%3Abug+label%3Aup-for-grabs).\n\n* Documentation\n\n  We are documenting all analyzers on the [CodeCracker user site](http://code-cracker.github.io/diagnostics.html).\n  There are lots of analyzers and code fixes to document.\n\n* Localization/Translation\n\n  We are starting to translate the analyzers and code fixes messages to other languages. If you want CodeCracker on your language feel free to create an issue and start working on it. If you want to help with an ongoing translation,\n  comment on the existing issue and say you are ready to help. We also need to update existing analyzers, which were not created ready for localization.\n\n## Issues and task board\n\n* The task board is at [Huboard](https://huboard.com/code-cracker/code-cracker/).\n* You can also check the [Github backlog](https://github.com/code-cracker/code-cracker/issues) directly.\n\n### Definition of Ready (DoR)\n\nAn item should only have its work started after the backlog item is ready. We have\ndefined ready as:\n\n1. Have most of the scenarios/test cases defined on the issue on Github\n2. If it has an analyzer then\n\n        1. The warning level of the analyzer must be in the issue's description (`Hidden`, `Information`, `Warning`, or `Error`)\n        2. The diagnostics it provides should already have numeric ids defined formatted as `CC0000`.\n3. If it has a code fix then the category should be in the issue's description. The supported categories are listed on the `SupportedCategories.cs` file.\n4. Have some of the maintainers verify it (cannot be the same one who wrote the issue and/or test cases)\n\nThe first one is important so we have clearly defined what we will build. The last one\nis important so we don't go on building something that will not be usable, will hurt users, or will\nbe a waste of effort.\n\nView examples at issues [#7](https://github.com/code-cracker/code-cracker/issues/7)\nand [#10](https://github.com/code-cracker/code-cracker/issues/10).\n\n### Severity Levels\n\nThese are the 4 severity levels supported on Roslyn and how they are understood on the Code Cracker project:\n\n1. **Hidden**: Only used for refactorings. See [#66](https://github.com/code-cracker/code-cracker/issues/66) (and its comments) to understand why.\n2. **Info**: An alternative way (ex: replacing for with foreach). Clearly, a matter of opinion and/or current way could be correct, or maybe the new code could be correct. We cannot determine.\n3. **Warning**: Code that could/should be improved. It is a code smell and most likely is wrong, but there are situations where the pattern is acceptable or desired.\n4. **Error**: Clearly a mistake (ex: throwing ArgumentException with a non-existent parameter). There is no situation where this code could be correct. There are no differences of opinion.\n\nYou can read [directly on Microsoft's source code](http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis/Diagnostic/DiagnosticSeverity.cs,e70281df673d47f6,references)\nhow they interpret these levels.\n\n### Definition of Done\n\nThe DoD is still evolving. At the present time the checklist is as follows:\n\n1. Builds\n2. Has tests for analyzers, code fixes (including fix all providers) and refactoring\n3. All tests pass\n4. Analyzers follow the guidelines for names\n\n        1. Always named `\u003cfeaturename\u003eAnalyzer`\n        2. Always add the diagnostic id to the `DiagnosticIds.cs` file.\n5. Code fixes should follow the guidelines for names\n\n        1. Always named `\u003cfeaturename\u003eCodeFixProvider`\n        2. Always use the same diagnostic id added to the `DiagnosticIds.cs` file, unless you are writing a code fix for a diagnostic id raised by the C# compiler itself (starting with `CS`).\n6. Fix all scenarios (fix all in a document, fix all in a project and fix all in solution) work. You might need to write a `FixAllProvider`. Check the `DisposableVariableNotDisposedFixAllProvider` as an example.\n7. Follow the coding standards present on the project code files.\n8. Works in Visual Studio\n9. Uses localizable strings\n\n### Start working\n\nOnce it is Ready and agreed on by anyone from the core team, just state in\na comment that you intend to start working on that item and mention any/all\nthe maintainers (use @code-cracker/owners) so they can tag it correctly and move it on the board.\n\nIf you are not familiar with the way Github works you might want to check the [Github guides](https://guides.github.com/), especially\nthe [Github flow](https://guides.github.com/introduction/flow/) one. The\n[GitHub for the Roslyn Team video](http://channel9.msdn.com/Blogs/dotnet/github-for-the-roslyn-team) might help you as well, and\nit also explains some Git concepts.\n\nTo start working fork the project on Github to your own account and clone it **from there**. Don't clone\nfrom the main CodeCracker repository. Before you start coding create a new branch and name it in a way that makes\nsense for the issue that you will be working on. Don't work on the `master` branch because that may make\nthings harder if you have to update your pull request or your repository later, assume your `master` branch\nalways equals the main repo `master` branch, and code on a different branch.\n\nWhen you commit, mention the issue number use the pound sign (#). Avoid making a lot of small commits\nunless they are meaningful. For most analyzers and code fixes a single commit should be enough. If you\nprefer to work with a lot commits at the end squash them.\n\nMake your first commit lines mean something, specially the first one.\n[Here](https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message) and\n[here](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) are some tips on a good\ncommit first line/message.\n\n**Do not**, under any circumstance, reformat the code to fit your standards. Follow the project standards,\nand if you do not agree with them discuss them openly with the Code Cracker community. Also, avoid end of line\nwhite spaces at all costs. Keep your code clean.\n\nAlways write unit tests for your analyzers, code fixes, fix all providers and analyzers.\n\n### Pull request\n\nWhen you are done, pull the changes from the `master` branch on the main CodeCracker repo and integrate them.\n\nYou have to do that in the command line:\n````bash\n# add the main repo with the `codecracker` name\ngit remote add code-cracker https://github.com/code-cracker/code-cracker.git\n# checkout the master branch\ngit checkout master\n# download the latest changes from the master repo\ngit pull code-cracker master\n# go back to your working branch\ngit checkout \u003cyoubranchname\u003e\n# integrate your changes\ngit merge master\n# solve integration conflicts\n````\n\nYou can solve the conflicts in your favorite text editor or Visual Studio.\nVisual Studio actually presents the conflict in a very nice way to solve them.\nAlso, on the `go back to your working branch` step you can go back to using Visual Studio to control git if you\nprefer that.\n\nIf you know git well, you can rebase your changes instead of merging them. If not, it is ok to merge them.\nWhen your changes are up to date with the\n`master` branch then you should push them to your Github repo and then you will be able to issue\na [pull request](https://help.github.com/articles/using-pull-requests/) and\nmention the issue you were working on. Make your PR message clear. If when you are creating the pull request on\nGithub it mentions that the PR cannot be merged because there are conflicts it means you forgot to integrate\nthe `master` branch. Correct that push the changes to your personal repo. This will automatically update the PR.\nThe project maintainers should not have to resolve merge conflicts, you should.\n\nAfter your pull request is accepted you may delete your local branch if you want. Update your `master` branch\nso you can continue to contribute in the future. And thank you! :)\n\nIf your pull request is denied try to understand why. It is not uncommon that PRs are denied but after some\ndiscussing and fixing they are accepted. Work with the community to get it to be the best possible code. And thank you!\n\n### Rules for contribution\n\n* Every pull request must have unit tests. PRs without tests will be denied without checking anything else.\n* Must build and all tests must pass\n* Must mention an existing issue on Github\n* Don't reformat any code but the one you produced\n* Follow the coding standards already in place within the project\n* One code issue per person at a time (blocked issues don't count)\n* Your pull requested will be commented by the Coveralls bot. Make sure code coverage has not gone down significantly. Ideally, it should go up.\n\nIf you work on something that you have not yet discussed with the maintainers\nthere is a chance the code might be denied because they might find the analyzer/fix is not necessary, duplicated, or some other reason.\nThey are easily reachable through Twitter or on Github. Before you code discuss it with it them.\n\nSmall code changes or updates outside code files will eventually be made by the core team directly on `master`, without a PR.\n\n\n## Maintainers/Core team\n\n* [Giovanni Bassi](http://blog.lambda3.com.br/L3/giovannibassi/), aka Giggio, [Lambda3](http://www.lambda3.com.br), [@giovannibassi](https://twitter.com/giovannibassi)\n* [Elemar Jr.](http://elemarjr.net/), [Promob](http://promob.com/), [@elemarjr](https://twitter.com/elemarjr)\n* [Carlos dos Santos](http://carloscds.net/), [CDS Informática](http://www.cds-software.com.br/), [@cdssoftware](https://twitter.com/cdssoftware)\n\nContributors can be found at the [contributors](https://github.com/code-cracker/code-cracker/graphs/contributors) page on Github.\n\n### What are the maintainers' responsibilities?\n\nThe maintainers have to:\n\n* Commit regularly.\n* Work on project maintenance tasks regularly, like (but not limited to)\n  * attend meetings,\n  * review pull requests,\n  * create and discuss on project issues.\n\nTo become part of the core team one has to be invited. Invitations happen only if all the core team agrees.\n\nIf a member of the core team is not active for at least two months, they will probably be removed from the core team.\n\n## Contact\n\nPlease see our [contact page](http://code-cracker.github.io/contact.html).\n\n## License\n\nThis software is open source, licensed under the Apache License, Version 2.0.\nSee [LICENSE.txt](https://github.com/code-cracker/code-cracker/blob/master/LICENSE.txt) for details.\nCheck out the terms of the license before you contribute, fork, copy or do anything\nwith the code. If you decide to contribute you agree to grant copyright of all your contribution to this project and agree to\nmention clearly if do not agree to these terms. Your work will be licensed with the project at Apache V2, along the rest of the code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-cracker%2Fcode-cracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-cracker%2Fcode-cracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-cracker%2Fcode-cracker/lists"}