Skip to content

GCI97 PreferAppendLeft #Python #DLG #RulesSpecifications - #381

Merged
dedece35 merged 6 commits into
green-code-initiative:mainfrom
cleophass:PreferAppendLeft
Aug 2, 2025
Merged

GCI97 PreferAppendLeft #Python #DLG #RulesSpecifications#381
dedece35 merged 6 commits into
green-code-initiative:mainfrom
cleophass:PreferAppendLeft

Conversation

@cleophass

Copy link
Copy Markdown
Contributor
  1. Rule specifcations for GCI97 Prefer Append Left
  2. Definition Of Done checked ✅
  3. Directly put GCI97 because it's absent from Rules.md
  4. mention of an issue created in a previous hackathon to reuse the work

Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
Comment thread src/main/rules/GCI97/GCI97.json
cleophass and others added 2 commits July 7, 2025 14:10
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
Comment thread RULES.md Outdated
cleophass and others added 2 commits July 17, 2025 11:31
… typo

Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
…nflicts

Co-authored-by: DataLabGroupe-CreditAgricole <GITHUB.DATALABGROUPE@CREDIT-AGRICOLE-SA.FR>
Comment thread CHANGELOG.md Outdated
Comment thread src/main/rules/GCI97/GCI97.json
Comment thread src/main/rules/GCI97/python/GCI97.asciidoc

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces rule GCI108 "Prefer Append Left" which recommends using deque's appendleft() method instead of list.insert(0, val) for inserting elements at the beginning of a list in Python. The rule is aimed at improving performance and reducing carbon emissions when performing frequent insertions at the start of a list.

  • Adds complete rule specification documentation with performance analysis and carbon emission measurements
  • Defines rule metadata in JSON configuration file
  • Updates project documentation to include the new rule

Reviewed Changes

Copilot reviewed 4 out of 8 changed files in this pull request and generated 3 comments.

File Description
src/main/rules/GCI108/python/GCI108.asciidoc Complete rule documentation with examples, performance analysis, and carbon emission data
src/main/rules/GCI108/GCI108.json Rule metadata configuration defining severity, tags, and remediation cost
RULES.md Updates rule registry to include GCI108 with description and language support matrix
CHANGELOG.md Documents the addition of GCI108 rule in the project changelog

Comment thread src/main/rules/GCI108/python/GCI108.asciidoc
Comment on lines +29 to +31
We'll analyze the impact of inserting 10**6 elements at index 0 of a list and compare this with inserting the same number of elements using a deque (deque stands for Double-Ended Queue. It is a data structure that allows adding and removing elements from both ends efficiently. Unlike regular queues, which are typically operated on using FIFO (First In, First Out) principles, a deque supports both FIFO and LIFO (Last In, First Out))


Copilot AI Jul 24, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an extremely long sentence that's difficult to read. Consider breaking it into multiple sentences or moving the deque definition to a separate paragraph.

Suggested change
We'll analyze the impact of inserting 10**6 elements at index 0 of a list and compare this with inserting the same number of elements using a deque (deque stands for Double-Ended Queue. It is a data structure that allows adding and removing elements from both ends efficiently. Unlike regular queues, which are typically operated on using FIFO (First In, First Out) principles, a deque supports both FIFO and LIFO (Last In, First Out))
We'll analyze the impact of inserting 10**6 elements at index 0 of a list and compare this with inserting the same number of elements using a deque.
A deque (short for Double-Ended Queue) is a data structure that allows adding and removing elements from both ends efficiently. Unlike regular queues, which are typically operated on using FIFO (First In, First Out) principles, a deque supports both FIFO and LIFO (Last In, First Out) operations.

Copilot uses AI. Check for mistakes.
Comment thread RULES.md Outdated
@dedece35
dedece35 merged commit a2995ec into green-code-initiative:main Aug 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants