Enable identical and similar code statements in CodeClimate configuration#10383
Enable identical and similar code statements in CodeClimate configuration#10383andreslucena merged 12 commits intodevelopfrom
Conversation
|
Overall I like this idea but I think we need to add some exclude rules for example to exclude Also some other issues it is identifying do not seem to make sense, as refactoring duplicated route definitions. To me the current way of defining the routes makes more sense. The other issues could be debated, such as repeating similarly named attributes in two different forms. Sometimes it makes more sense to repeat, sometimes it might make more sense to refactor to a common module. As said, overall I like this kind of changes but I'm just not sure if any of the issues created through this change by Code Climate make sense in the real world. |
|
The main ideea, is not to generate more work, but to use the tool so we could identify duplicate code ... There are a few lines of code, that could be extracted in a concern (that may either reside in decidim-core, or along with other space related elements could be the base of an abstract module like decidim-generic-spaces), or we could use STI model. |
Regarding the exceptions that we want to create, we could ignore it from code-climate ... yes, is going a bit of work until we get it to green, but would be better on the long run. |
|
To move this forward, this is my take in all the issues to fix detected by codeclimate: scope_types_controller.rb and area_types_controller.rbAreas is not actively maintained. On @decidim/product we've discussed that we wanted to deprecated and integrate it better in Scopes. See https://docs.decidim.org/en/develop/admin/areas.html We can ignore this for the moment (adding an exclusion) meeting_m_cell.rb and meeting_s_cell.rbI'm not sure if they're still relevant with the Redesign. On the other hand I see that MeetingSCell is inheriting from MeetingMCell so we could remove it from there? voting_stats_presenter.rb and assembly_stats_presenter.rbSeems like it's also missing participatory_process_stats_presenter.rb We could do a ParticipatorySpaceStatsPresenter or something like that, but I'm not so sure if this will be still relevant with the Redesign as the plan is to migrate these to ContentBlocks. filters_participatory_space_user_roles_examples.rb and filters_participatory_space_users_examples.rbI think that by changing wording/naming a bit we could remove one of those amendment_accepted_event_examples.rb and amendment_rejected_event_examples.rbWe could probably refactor and DRY this up. add_questions.rbWe could probably refactor and DRY this up. invites.rb and conference_invites.rbWe could probably refactor and DRY this up. admin_engine.rb and admin_engine.rbAka the routes in spaces. This will probably happen to with Votings and Conferences. I agree that ignoring it for now will be cleaner as it's on the Rails routes DSL and I'm not so sure how to tackle it. assembly_publications_controller.rb and conference_publications_controller.rbIt probably also happens on other Spaces. We could do a polling_officer_form.rb and monitoring_committee_member_form.rbWe could probably refactor and DRY this up. All in all, I think that as fixing all of these issues could be too much effort, for now I'd add them as exclusions, so we can merge this new change in the configuration and keep it from introducing new ones. I think that our current priority should be on lowering the number of open PRs. With the rest we should probably discuss a bit more if they're worth the effort, or we can live with a bit of duplication for now. Also to take into account is that sometimes CodeClimate find only two locations but for sure it could be more, specially the ones that's detecting about Spaces (ie it only detects similarity between |
|
@alecslupu have you seen my last comment? |
|
Yes, i have seen it.
I did not reached to it yet.
On Thu, 25 May 2023 at 17:02, Andrés Pereira de Lucena < ***@***.***> wrote:
@alecslupu <https://github.com/alecslupu> have you seen my last comment
<#10383 (comment)>?
—
Reply to this email directly, view it on GitHub
<#10383 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZZUZU2FICPRUITUCXKCTXH5Q6FANCNFSM6AAAAAAU3HBZ6M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Sent from Gmail Mobile
|
andreslucena
left a comment
There was a problem hiding this comment.
I'd add some exclusions here as these are things that we can live with some identical/similarity.
Regarding the one that's missing (filterable), I'm working on it
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
|
I've merged with develop to see that the last CodeClimate offense is fixed and then if everything is OK I'll merge this PR. 🤞🏽 |
🎩 What? Why?
In order to increase the maintainability, we have to identify duplicated code, so that we may address the issue at some point.