{"id":16861293,"url":"https://github.com/rumpl/pepper","last_synced_at":"2025-03-18T14:46:39.913Z","repository":{"id":6896433,"uuid":"8146174","full_name":"rumpl/pepper","owner":"rumpl","description":null,"archived":false,"fork":false,"pushed_at":"2016-12-27T08:55:56.000Z","size":148,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-24T19:27:20.654Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rumpl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-11T20:41:20.000Z","updated_at":"2016-12-27T08:55:21.000Z","dependencies_parsed_at":"2022-09-03T21:22:16.355Z","dependency_job_id":null,"html_url":"https://github.com/rumpl/pepper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumpl%2Fpepper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumpl%2Fpepper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumpl%2Fpepper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumpl%2Fpepper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumpl","download_url":"https://codeload.github.com/rumpl/pepper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244245645,"owners_count":20422443,"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":[],"created_at":"2024-10-13T14:31:12.914Z","updated_at":"2025-03-18T14:46:39.887Z","avatar_url":"https://github.com/rumpl.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pepper\n\nPepper will analyze your code and find different bad practices like methods\nthat are too long or using the double equals.\n\nPepper is good for you.\n\n## Installation\n\nWith composer for a local lala.\n\nWith PEAR:\n   pear install pepper\n\n## Usage\n\nRun pepper without any parameters to see the usage.\n\nTo analyze a single file:\n```bash\npepper -f \u003cfile\u003e\n```\n\n## Configuration\n\nBy default, pepper will search for the `pepperconfig.yml` file in the current directory. If none is found it will run with some default configuration.\nThe `pepperconfig.yml` sould be as follows:\n\n```yaml\nRuleName1:\n  level: [notice|warning|error]\n  params:\n      param1: value1\n      param2: value2\n\nRuleName2:\n  level: [notice|warning|error]\n  params:\n      param1: value1\n      param2: value2\n```\n\nThe `params` key is optional and is used only if the rule can be configured. For exemple, the rule for global variables doesn't need any configuration,\non the other hand, the rule for checking method length takes a parameter named `threshold`.\n\nHere is a real example of a pepper configuration file :\n```yaml\nPepper\\Rule\\MethodTooLong:\n   level: warning\n   params:\n      threshold: 2\n\nPepper\\Rule\\UnnecessaryIf:\n   level: warning\n\nPepper\\Rule\\GlobalVariable:\n   level: notice\n```\n\n## Rules\n\nPepper has a growing number of rules that you can activate at your will:\n\n### Double equals\n\nWill warn you about the usage of the double equals statement.\n\nPHP has two comparison operators, the equals operator (==) and the identity operator (===).\nIt is considered bad practice to use the double equals operator.\n\nSome examples why using the double equals operator may introduce bugs in your code:\n```php\n1 == '1' // true, note that this can be useful in some cases\n'1 some text' == '1' // false\n'1 some text' == 1 // true\n```\nAlso, note that\n```php\n'424572979023470974209347293457249724907234928347' == $n;\n```\nis way slower than\n```php\n$n == '424572979023470974209347293457249724907234928347';\n```\nI will explain this in a second.\n\nOn the other hand, here is what would the identity operator return:\n```php\n1 === '1' // false\n'1 some text' === '1' // false\n'1 some text' === 1 // false\n```\nHere is an overview of the _double equals_ algorithm:\nLet _a_ and _b_ be the left and right values.\n * Compare the types of the two values\n * If the two values have the same type, compare their values.\n * If the two values don't have the same type:\n    * If _a_ is a string and _b_ is a number, convert _a_ to a number and then compare the two values.\n    * yada yada yada\n\n\nAll that being said, you should not follow this kind of \"best practices\" blindly. It is important that you understand what is happening behind the scene in order to use the appropriate operators. This is exactly why **Pepper** can be configured not to show warnings line by line in your code.\n\n### Global variable\n\nWill warn you about the usage of global variable.\n\n### Method too long\n\nWill warn you if a method is too long. When is a method too long ? That's up\nto you to decide, everything is customizable in Pepper.\n\n### Nesting too deep\n\nToo much nesting is not good for you, Pepper can warn you if you have to much\nnesting in your code. Once again, customizable, Pepper is awesome!\n\n## License\n\n[MIT](http://rumpl.mit-license.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumpl%2Fpepper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumpl%2Fpepper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumpl%2Fpepper/lists"}