Namesake-Scoped is a fork of the Namesake repository with additional features.
Namesake is an open-source tool for assessing confusing naming combinations in Python programs. Namesake flags confusing identifier naming combinations that are similar in:
- orthography (word form)
- phonology (pronunciation)
- or semantics (meaning).
Namesake-Scoped is an improve version of Namesake with the ability to only check identifiers with same scope. It also checks for identifer quality as according to PEP8 and best programming practices for python.
Lexical access describes the retrieval of word shape (orthography), pronunciation (phonology), and meaning (semantics) from memory during reading for comprehension.
Orthographic similarity focuses on the the similarity in word form on the level of letters. Not to be confused by editing distance or Levenshtein's distance, where one letter is replaced by another, orthographic similarity focuses on the similarities between letters shapes. A good example is the confusion between 'O' and 'C' as individual letters or within words and sentences. Here's a common exmple in code:
Phonological similarity describes two words that share a similar or identical pronunciation, also known as homophones:
Semantic similarity describes words that share a meaning (synonyms):
In our checker, we get list method names and variable names from a python file and check it according to these criterias.
| Criteria | Describtion |
|---|---|
| Naming Style | The variable name should be in snake_case style or should be in uppercase if it's a constant or has only been assigned once |
| Verb Phrase | The variable name should be a noun or noun phrase |
| Dict. Terms | The variable name should not contain any unrecognized words |
| Full Words | The variable name should not contain any single-letter words or numbers |
| Idioms/Slang | The variable name should not contain any idioms or slang |
| Abbrev. | The variable name should not conflict with any Python built-in identifiers |
| Length | The variable name should not exceed 79 characters |
| Criteria | Describtion |
|---|---|
| Naming Style | The method name should be in snake_case style |
| Verb Phrase | The method name should be a verb or verb phrase |
| Dict. Terms | The method name should not contain any unrecognized words |
| Full Words | The method name should not contain any single-letter words or numbers |
| Idioms/Slang | The method name should not contain any idioms or slang |
| Abbrev. | The method name should not conflict with any Python built-in identifiers |
| Length | The method name should not contain more than 7 words |
To use Namesake-Scoped, you can follow these steps:
- Clone the Namesake-Scoped repository using git clone https://github.com/minhphd/Namesake-Scoped.git
- Navigate to the directory where Namesake-Scoped is cloned using
cd Namesake-Scoped
- Install any necessary dependencies using
pip install -r requirements.txt
- Run Namesake-Scoped using the command
python3.9 namesake_with_scope.py [path to your code file].
The threshold for orthographic, phonological, and semantic warnings are set at .45, .8, and .9 respectively. Thresholds can be changed manually through editing line 309, 310, and 311 in the namesake_with_scope.py file.
- To check for identifiers naming quality, run
python3.9 identifiers_quality_checkers.py [path to your code file]
MIT (Free Software, Hell Yeah!)




