https://github.com/anapaulagomes/looong
Discovery of Long Parameter List
https://github.com/anapaulagomes/looong
codesmells refactoring tox
Last synced: about 1 year ago
JSON representation
Discovery of Long Parameter List
- Host: GitHub
- URL: https://github.com/anapaulagomes/looong
- Owner: anapaulagomes
- License: other
- Archived: true
- Created: 2017-04-04T19:16:39.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-28T12:40:47.000Z (over 8 years ago)
- Last Synced: 2024-10-31T08:37:56.228Z (over 1 year ago)
- Topics: codesmells, refactoring, tox
- Language: Jupyter Notebook
- Size: 70.3 KB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Looong
Keeping eyes on long parameters list 🔍
[](https://travis-ci.org/anapaulagomes/looong) [](https://codeclimate.com/github/anapaulagomes/looong) [](https://landscape.io/github/anapaulagomes/looong/master)
Long parameter list is a code smell - a clue that there is a problem on your software design. To help you on this this module has been written to identify methods with long parameter list and to suggest parameters groups that could became potential object because they appear together.
## Usage
### Installing
```bash
$ make install
```
We recommend the use of virtual environment.
### Running
```bash
$ python looong/main.py -d
```
```bash
Analyzed files: 553
Analyzed methods: 2224
render [django/shortcuts.py] ['request', 'template_name', 'context', 'content_type', 'status', 'using'] 6
create [django/contrib/admin/filters.py] ['field', 'request', 'params', 'model', 'model_admin', 'field_path'] 6
kml [django/contrib/gis/sitemaps/views.py] ['request', 'label', 'model', 'field_name', 'compress', 'using'] 6
run [django/core/servers/basehttp.py] ['addr', 'port', 'wsgi_handler', 'ipv6', 'threading', 'server_cls'] 6
data [django/contrib/gis/gdal/raster/band.py] ['data', 'offset', 'size', 'shape', 'as_memoryview'] 5
kmz [django/contrib/gis/sitemaps/views.py] ['request', 'label', 'model', 'field_name', 'using'] 5
dumps [django/core/signing.py] ['obj', 'key', 'salt', 'serializer', 'compress'] 5
loads [django/core/signing.py] ['s', 'key', 'salt', 'serializer', 'max_age'] 5
migrate [django/db/migrations/executor.py] ['targets', 'plan', 'state', 'fake', 'fake_initial'] 5
connect [django/db/models/signals.py] ['receiver', 'sender', 'weak', 'dispatch_uid', 'apps'] 5
```
### Goal
Methods with long parameter list pointing to a problem with OO principles. One of the approach to solve is creating objects with the parameters that appear more together. Our goal is cluster this parameters and suggest as objects.
```
LoooooooooooooooooooooooooooooooooooG
Analyzed files: 553
Analyzed methods: 2224
render [django/shortcuts.py] ['request', 'template_name', 'context', 'content_type', 'status', 'using'] 6
create [django/contrib/admin/filters.py] ['field', 'request', 'params', 'model', 'model_admin', 'field_path'] 6
kml [django/contrib/gis/sitemaps/views.py] ['request', 'label', 'model', 'field_name', 'compress', 'using'] 6
run [django/core/servers/basehttp.py] ['addr', 'port', 'wsgi_handler', 'ipv6', 'threading', 'server_cls'] 6
Correlated parameters and possible objects:
(foo, bar)
(foo, bar, barbar)
```
## Development
Please see [our contribution guide](CONTRIBUTING.md).