You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/01/11 11:00:04 UTC

[GitHub] [incubator-nuttx] wingunder opened a new pull request #78: Added a tool for listing the percentage of common lines in text files.

wingunder opened a new pull request #78: Added a tool for listing the percentage of common lines in text files.
URL: https://github.com/apache/incubator-nuttx/pull/78
 
 
   This commit adds `./tools/listcommonpercentage.sh`, that uses
   `wdiff -123 -s` in order to get the percentage of common lines of text
   for each supplied file, relative to all other supplied files. It can be
   used to identify copies or semi-copies of files.
   
   Please read the description inside `./tools/listcommonpercentage.sh` and
   `./tools/README.txt`, for usage information and examples.
   
   There seems to be a lot of duplicate code and makefiles in at least
   the `./boards/` tree. I hope that this tool can be used to pinpoint the
   amount duplication.
   
   eg: Use the following command to find files with similar names:
   
   ```bash
   $ ls ./drivers/sensors/*.c |awk '{print "basename " $1}' |sh |awk \
   '{print "find . -type f -name \*" $1}' |sh |grep ^./boards \
   awk: cmd. line:1: warning: escape sequence `\*' treated as plain `*'
   ```
   
   Now pick stm32_bmp180.c and list the stats on it's duplication:
   
   ```bash
   $ find ./boards/ -type f -name stm32_bmp180.c |PERCENT_SIGN="" \
   DELIM=" " xargs ./tools/listcommonpercentage.sh |sort -rnk2
   ```
   
   Also pick stm32_qencoder.c and list the stats on it's duplication:
   
   ```bash
   $ find ./boards/ -type f -name stm32_qencoder.c |PERCENT_SIGN="" \
   DELIM=" "  xargs ./tools/listcommonpercentage.sh |sort -nk2
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo closed pull request #78: Added a tool for listing the percentage of common lines in text files.

Posted by GitBox <gi...@apache.org>.
patacongo closed pull request #78: Added a tool for listing the percentage of common lines in text files.
URL: https://github.com/apache/incubator-nuttx/pull/78
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on issue #78: Added a tool for listing the percentage of common lines in text files.

Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #78: Added a tool for listing the percentage of common lines in text files.
URL: https://github.com/apache/incubator-nuttx/pull/78#issuecomment-573320929
 
 
   I am going to close the PR without incorporating it.  I do not want to see a tool that encourages this bad way of thinking in the OS.  The imporant values are architecture modularly and clean interfaces.  This could potentially destroy both.
   
   There is no benefit to reducing code duplication.  Duplication is good.  It permits the modular architecture and it allows customizations.  Combining unrelated code for no reason other than it is similar is a terrible idea and cannot be considered.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services