qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/3] scripts/checkpatch: Add code spelling check
@ 2023-12-04  8:29 Zhao Liu
  2023-12-04  8:29 ` [RFC 1/3] scripts/checkpatch: Check common spelling be default Zhao Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Zhao Liu @ 2023-12-04  8:29 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, Philippe Mathieu-Daudé,
	Paolo Bonzini, Thomas Huth, Richard Henderson, qemu-devel
  Cc: qemu-trivial, Zhenyu Wang, Zhao Liu

From: Zhao Liu <zhao1.liu@intel.com>

Inspired by Linux's spelling check, QEMU could also add the similar
support in checkpatch.pl to help ease the burden on trivial's
maintainers ;-).

QEMU's checkpatch.pl is mainly based on an older version of Linux's
checkpatch.pl, so this RFC ports Linux's codespell-related functionality
to QEMU.

This RFC contains mainly the following work:
* Added default typo dictionary "selling.text". When using checkpatch.pl,
  it will be based on selling.txt for typo checking.
* Added "--codespell" and "--codespellfile" options for enhanced spell
  checking. The former will use either the system dictionary or a python
  dictionary for spell checking, while the latter allows the user to use
  a customized dictionary.
* Based on the QEMU typo statistics from v7.0.0 to v8.2.0-rc2, updated
  the default dictionary "selling.txt" to be more in line with QEMU
  developers' "typo habits".

Thanks and Best Regards,
Zhao
---
Zhao Liu (3):
  scripts/checkpatch: Check common spelling be default
  scripts/checkpatch: Add --codespell and --codespellfile options
  scripts/spelling: Add common spelling mistakes in default spelling.txt

 scripts/checkpatch.pl |  110 ++-
 scripts/spelling.txt  | 1729 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1838 insertions(+), 1 deletion(-)
 create mode 100644 scripts/spelling.txt

-- 
2.34.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC 1/3] scripts/checkpatch: Check common spelling be default
  2023-12-04  8:29 [RFC 0/3] scripts/checkpatch: Add code spelling check Zhao Liu
@ 2023-12-04  8:29 ` Zhao Liu
  2023-12-04  9:07   ` Thomas Huth
  2023-12-04  8:29 ` [RFC 2/3] scripts/checkpatch: Add --codespell and --codespellfile options Zhao Liu
  2023-12-04  8:29 ` [RFC 3/3] scripts/spelling: Add common spelling mistakes in default spelling.txt Zhao Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Zhao Liu @ 2023-12-04  8:29 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, Philippe Mathieu-Daudé,
	Paolo Bonzini, Thomas Huth, Richard Henderson, qemu-devel
  Cc: qemu-trivial, Zhenyu Wang, Zhao Liu

From: Zhao Liu <zhao1.liu@intel.com>

Add the check for common spelling mistakes for QEMU, which stole
selling.txt from Linux kernel and referenced the Linux kernel's
implementation in checkpatch.pl.

This check covers common spelling mistakes, and can be updated/
extended as per QEMU's realities.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 scripts/checkpatch.pl |   44 ++
 scripts/spelling.txt  | 1713 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1757 insertions(+)
 create mode 100644 scripts/spelling.txt

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 6e4100d2a41c..755a1f683866 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7,10 +7,13 @@
 
 use strict;
 use warnings;
+use File::Basename;
+use Cwd 'abs_path';
 use Term::ANSIColor qw(:constants);
 
 my $P = $0;
 $P =~ s@.*/@@g;
+my $D = dirname(abs_path($0));
 
 our $SrcFile    = qr{\.(?:(h|c)(\.inc)?|cpp|s|S|pl|py|sh)$};
 
@@ -35,6 +38,7 @@ my $summary_file = 0;
 my $root;
 my %debug;
 my $help = 0;
+my $spelling_file = "$D/spelling.txt";
 
 sub help {
 	my ($exitcode) = @_;
@@ -337,6 +341,31 @@ our @typeList = (
 	qr{guintptr},
 );
 
+# Load common spelling mistakes and build regular expression list.
+my $misspellings;
+my %spelling_fix;
+
+if (open(my $spelling, '<', $spelling_file)) {
+	while (<$spelling>) {
+		my $line = $_;
+
+		$line =~ s/\s*\n?$//g;
+		$line =~ s/^\s*//g;
+
+		next if ($line =~ m/^\s*#/);
+		next if ($line =~ m/^\s*$/);
+
+		my ($suspect, $fix) = split(/\|\|/, $line);
+
+		$spelling_fix{$suspect} = $fix;
+	}
+	close($spelling);
+} else {
+	warn "No typos will be found - file '$spelling_file': $!\n";
+}
+
+$misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix;
+
 # This can be modified by sub possible.  Since it can be empty, be careful
 # about regexes that always match, because they can cause infinite loops.
 our @modifierList = (
@@ -1585,6 +1614,21 @@ sub process {
 			WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
 		}
 
+# Check for various typo / spelling mistakes
+		if (defined($misspellings) &&
+		    ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
+			while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) {
+				my $typo = $1;
+				my $blank = copy_spacing($rawline);
+				my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo);
+				my $hereptr = "$hereline$ptr\n";
+				my $typo_fix = $spelling_fix{lc($typo)};
+				$typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
+				$typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
+				WARN("'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $hereptr);
+			}
+		}
+
 # ignore non-hunk lines and lines being removed
 		next if (!$hunk_line || $line =~ /^-/);
 
diff --git a/scripts/spelling.txt b/scripts/spelling.txt
new file mode 100644
index 000000000000..549ffd0f2d78
--- /dev/null
+++ b/scripts/spelling.txt
@@ -0,0 +1,1713 @@
+# Originally from Debian's Lintian tool. Various false positives have been
+# removed, and various additions have been made as they've been discovered
+# in the kernel source.
+#
+# License: GPLv2
+#
+# Stolen from Linux v6.7-rc4 (@15571273db93).
+#
+# The format of each line is:
+# mistake||correction
+#
+abandonning||abandoning
+abigious||ambiguous
+abitrary||arbitrary
+abitrate||arbitrate
+abnornally||abnormally
+abnrormal||abnormal
+abord||abort
+aboslute||absolute
+abov||above
+abreviated||abbreviated
+absense||absence
+absolut||absolute
+absoulte||absolute
+acccess||access
+acceess||access
+accelaration||acceleration
+accelearion||acceleration
+acceleratoin||acceleration
+accelleration||acceleration
+accesing||accessing
+accesnt||accent
+accessable||accessible
+accesss||access
+accidentaly||accidentally
+accidentually||accidentally
+acclerated||accelerated
+accoding||according
+accomodate||accommodate
+accomodates||accommodates
+accordign||according
+accoring||according
+accout||account
+accquire||acquire
+accquired||acquired
+accross||across
+accumalate||accumulate
+accumalator||accumulator
+acessable||accessible
+acess||access
+acessing||accessing
+achitecture||architecture
+acient||ancient
+acitions||actions
+acitve||active
+acknowldegement||acknowledgment
+acknowledgement||acknowledgment
+ackowledge||acknowledge
+ackowledged||acknowledged
+acording||according
+activete||activate
+actived||activated
+actualy||actually
+actvie||active
+acumulating||accumulating
+acumulative||accumulative
+acumulator||accumulator
+acutally||actually
+adapater||adapter
+adderted||asserted
+addional||additional
+additionaly||additionally
+additonal||additional
+addres||address
+adddress||address
+addreses||addresses
+addresss||address
+addrress||address
+aditional||additional
+aditionally||additionally
+aditionaly||additionally
+adminstrative||administrative
+adress||address
+adresses||addresses
+adrresses||addresses
+advertisment||advertisement
+adviced||advised
+afecting||affecting
+againt||against
+agaist||against
+aggreataon||aggregation
+aggreation||aggregation
+ajust||adjust
+albumns||albums
+alegorical||allegorical
+algined||aligned
+algorith||algorithm
+algorithmical||algorithmically
+algoritm||algorithm
+algoritms||algorithms
+algorithmn||algorithm
+algorrithm||algorithm
+algorritm||algorithm
+aligment||alignment
+alignement||alignment
+allign||align
+alligned||aligned
+alllocate||allocate
+alloated||allocated
+allocatote||allocate
+allocatrd||allocated
+allocte||allocate
+allocted||allocated
+allpication||application
+alocate||allocate
+alogirhtms||algorithms
+alogrithm||algorithm
+alot||a lot
+alow||allow
+alows||allows
+alreay||already
+alredy||already
+altough||although
+alue||value
+ambigious||ambiguous
+ambigous||ambiguous
+amoung||among
+amount of times||number of times
+amout||amount
+amplifer||amplifier
+amplifyer||amplifier
+an union||a union
+an user||a user
+an userspace||a userspace
+an one||a one
+analysator||analyzer
+ang||and
+anniversery||anniversary
+annoucement||announcement
+anomolies||anomalies
+anomoly||anomaly
+anway||anyway
+aplication||application
+appearence||appearance
+applicaion||application
+appliction||application
+applictions||applications
+applys||applies
+appplications||applications
+appropiate||appropriate
+appropriatly||appropriately
+approriate||appropriate
+approriately||appropriately
+apropriate||appropriate
+aquainted||acquainted
+aquired||acquired
+aquisition||acquisition
+arbitary||arbitrary
+architechture||architecture
+archtecture||architecture
+arguement||argument
+arguements||arguments
+arithmatic||arithmetic
+aritmetic||arithmetic
+arne't||aren't
+arraival||arrival
+artifical||artificial
+artillary||artillery
+asign||assign
+asser||assert
+assertation||assertion
+assertting||asserting
+assgined||assigned
+assiged||assigned
+assigment||assignment
+assigments||assignments
+assistent||assistant
+assocaited||associated
+assocating||associating
+assocation||association
+associcated||associated
+assotiated||associated
+asssert||assert
+assum||assume
+assumtpion||assumption
+asuming||assuming
+asycronous||asynchronous
+asychronous||asynchronous
+asynchnous||asynchronous
+asynchronus||asynchronous
+asynchromous||asynchronous
+asymetric||asymmetric
+asymmeric||asymmetric
+atleast||at least
+atomatically||automatically
+atomicly||atomically
+atempt||attempt
+atrributes||attributes
+attachement||attachment
+attatch||attach
+attched||attached
+attemp||attempt
+attemps||attempts
+attemping||attempting
+attepmpt||attempt
+attnetion||attention
+attruibutes||attributes
+authentification||authentication
+authenicated||authenticated
+automaticaly||automatically
+automaticly||automatically
+automatize||automate
+automatized||automated
+automatizes||automates
+autonymous||autonomous
+auxillary||auxiliary
+auxilliary||auxiliary
+avaiable||available
+avaible||available
+availabe||available
+availabled||available
+availablity||availability
+availaible||available
+availale||available
+availavility||availability
+availble||available
+availiable||available
+availible||available
+avalable||available
+avaliable||available
+aysnc||async
+backgroud||background
+backword||backward
+backwords||backwards
+bahavior||behavior
+bakup||backup
+baloon||balloon
+baloons||balloons
+bandwith||bandwidth
+banlance||balance
+batery||battery
+battey||battery
+beacuse||because
+becasue||because
+becomming||becoming
+becuase||because
+beeing||being
+befor||before
+begining||beginning
+beter||better
+betweeen||between
+bianries||binaries
+bitmast||bitmask
+bitwiedh||bitwidth
+boardcast||broadcast
+borad||board
+boundry||boundary
+brievely||briefly
+brigde||bridge
+broadcase||broadcast
+broadcat||broadcast
+bufer||buffer
+bufferred||buffered
+bufufer||buffer
+cacluated||calculated
+caculate||calculate
+caculation||calculation
+cadidate||candidate
+cahces||caches
+calender||calendar
+calescing||coalescing
+calle||called
+callibration||calibration
+callled||called
+callser||caller
+calucate||calculate
+calulate||calculate
+cancelation||cancellation
+cancle||cancel
+cant||can't
+cant'||can't
+canot||cannot
+cann't||can't
+cannnot||cannot
+capabiity||capability
+capabilites||capabilities
+capabilties||capabilities
+capabilty||capability
+capabitilies||capabilities
+capablity||capability
+capatibilities||capabilities
+capapbilities||capabilities
+caputure||capture
+carefuly||carefully
+cariage||carriage
+casued||caused
+catagory||category
+cehck||check
+challange||challenge
+challanges||challenges
+chache||cache
+chanell||channel
+changable||changeable
+chanined||chained
+channle||channel
+channnel||channel
+charachter||character
+charachters||characters
+charactor||character
+charater||character
+charaters||characters
+charcter||character
+chcek||check
+chck||check
+checksumed||checksummed
+checksuming||checksumming
+childern||children
+childs||children
+chiled||child
+chked||checked
+chnage||change
+chnages||changes
+chnange||change
+chnnel||channel
+choosen||chosen
+chouse||chose
+circumvernt||circumvent
+claread||cleared
+clared||cleared
+closeing||closing
+clustred||clustered
+cnfiguration||configuration
+coexistance||coexistence
+colescing||coalescing
+collapsable||collapsible
+colorfull||colorful
+comand||command
+comit||commit
+commerical||commercial
+comming||coming
+comminucation||communication
+commited||committed
+commiting||committing
+committ||commit
+commnunication||communication
+commoditiy||commodity
+comsume||consume
+comsumer||consumer
+comsuming||consuming
+comaptible||compatible
+compability||compatibility
+compaibility||compatibility
+comparsion||comparison
+compatability||compatibility
+compatable||compatible
+compatibililty||compatibility
+compatibiliy||compatibility
+compatibilty||compatibility
+compatiblity||compatibility
+competion||completion
+compilant||compliant
+compleatly||completely
+completition||completion
+completly||completely
+complient||compliant
+componnents||components
+compoment||component
+comppatible||compatible
+compres||compress
+compresion||compression
+compresser||compressor
+comression||compression
+comsumed||consumed
+comunicate||communicate
+comunication||communication
+conbination||combination
+conditionaly||conditionally
+conditon||condition
+condtion||condition
+condtional||conditional
+conected||connected
+conector||connector
+configration||configuration
+configred||configured
+configuartion||configuration
+configuation||configuration
+configued||configured
+configuratoin||configuration
+configuraton||configuration
+configuretion||configuration
+configutation||configuration
+conider||consider
+conjuction||conjunction
+connecetd||connected
+connectinos||connections
+connetor||connector
+connnection||connection
+connnections||connections
+consistancy||consistency
+consistant||consistent
+containes||contains
+containts||contains
+contaisn||contains
+contant||contact
+contence||contents
+contiguos||contiguous
+continious||continuous
+continous||continuous
+continously||continuously
+continueing||continuing
+contraints||constraints
+contruct||construct
+contol||control
+contoller||controller
+controled||controlled
+controler||controller
+controll||control
+contruction||construction
+contry||country
+conuntry||country
+convertion||conversion
+convertor||converter
+convienient||convenient
+convinient||convenient
+corected||corrected
+correponding||corresponding
+correponds||corresponds
+correspoding||corresponding
+cotrol||control
+cound||could
+couter||counter
+coutner||counter
+creationg||creating
+cryptocraphic||cryptographic
+cummulative||cumulative
+cunter||counter
+curently||currently
+cylic||cyclic
+dafault||default
+deactive||deactivate
+deafult||default
+deamon||daemon
+debouce||debounce
+decendant||descendant
+decendants||descendants
+decompres||decompress
+decsribed||described
+decription||description
+dectected||detected
+defailt||default
+deferal||deferral
+deffered||deferred
+defferred||deferred
+definate||definite
+definately||definitely
+definiation||definition
+definiton||definition
+defintion||definition
+defintions||definitions
+defualt||default
+defult||default
+deintializing||deinitializing
+deintialize||deinitialize
+deintialized||deinitialized
+deivce||device
+delared||declared
+delare||declare
+delares||declares
+delaring||declaring
+delemiter||delimiter
+delibrately||deliberately
+delievered||delivered
+demodualtor||demodulator
+demension||dimension
+dependancies||dependencies
+dependancy||dependency
+dependant||dependent
+dependend||dependent
+depreacted||deprecated
+depreacte||deprecate
+desactivate||deactivate
+desciptor||descriptor
+desciptors||descriptors
+descripto||descriptor
+descripton||description
+descrition||description
+descritptor||descriptor
+desctiptor||descriptor
+desriptor||descriptor
+desriptors||descriptors
+desination||destination
+destionation||destination
+destoried||destroyed
+destory||destroy
+destoryed||destroyed
+destorys||destroys
+destroied||destroyed
+detabase||database
+deteced||detected
+detecion||detection
+detectt||detect
+detroyed||destroyed
+develope||develop
+developement||development
+developped||developed
+developpement||development
+developper||developer
+developpment||development
+deveolpment||development
+devided||divided
+deviece||device
+devision||division
+diable||disable
+diabled||disabled
+dicline||decline
+dictionnary||dictionary
+didnt||didn't
+diferent||different
+differrence||difference
+diffrent||different
+differenciate||differentiate
+diffreential||differential
+diffrentiate||differentiate
+difinition||definition
+digial||digital
+dimention||dimension
+dimesions||dimensions
+diconnected||disconnected
+disabed||disabled
+disasembler||disassembler
+disble||disable
+disgest||digest
+disired||desired
+dispalying||displaying
+dissable||disable
+diplay||display
+directon||direction
+direcly||directly
+direectly||directly
+diregard||disregard
+disassocation||disassociation
+disapear||disappear
+disapeared||disappeared
+disappared||disappeared
+disbale||disable
+disbaled||disabled
+disble||disable
+disbled||disabled
+disconnet||disconnect
+discontinous||discontinuous
+disharge||discharge
+disnabled||disabled
+dispertion||dispersion
+dissapears||disappears
+dissconect||disconnect
+distiction||distinction
+divisable||divisible
+divsiors||divisors
+dsiabled||disabled
+docuentation||documentation
+documantation||documentation
+documentaion||documentation
+documment||document
+doesnt||doesn't
+donwload||download
+donwloading||downloading
+dorp||drop
+dosen||doesn
+downlad||download
+downlads||downloads
+droped||dropped
+droput||dropout
+druing||during
+dyanmic||dynamic
+dynmaic||dynamic
+eanable||enable
+eanble||enable
+easilly||easily
+ecspecially||especially
+edditable||editable
+editting||editing
+efective||effective
+effectivness||effectiveness
+efficently||efficiently
+ehther||ether
+eigth||eight
+elementry||elementary
+eletronic||electronic
+embeded||embedded
+enabledi||enabled
+enbale||enable
+enble||enable
+enchanced||enhanced
+encorporating||incorporating
+encrupted||encrypted
+encrypiton||encryption
+encryptio||encryption
+endianess||endianness
+enpoint||endpoint
+enhaced||enhanced
+enlightnment||enlightenment
+enqueing||enqueuing
+entires||entries
+entites||entities
+entrys||entries
+enocded||encoded
+enought||enough
+enterily||entirely
+enviroiment||environment
+enviroment||environment
+environement||environment
+environent||environment
+eqivalent||equivalent
+equiped||equipped
+equivelant||equivalent
+equivilant||equivalent
+eror||error
+errorr||error
+errror||error
+estbalishment||establishment
+etsablishment||establishment
+etsbalishment||establishment
+evalute||evaluate
+evalutes||evaluates
+evalution||evaluation
+excecutable||executable
+excceed||exceed
+exceded||exceeded
+exceds||exceeds
+exceeed||exceed
+excellant||excellent
+exchnage||exchange
+execeeded||exceeded
+execeeds||exceeds
+exeed||exceed
+exeeds||exceeds
+exeuction||execution
+existance||existence
+existant||existent
+exixt||exist
+exsits||exists
+exlcude||exclude
+exlcuding||excluding
+exlcusive||exclusive
+exlusive||exclusive
+exmaple||example
+expecially||especially
+experies||expires
+explicite||explicit
+explicitely||explicitly
+explict||explicit
+explictely||explicitly
+explictly||explicitly
+expresion||expression
+exprimental||experimental
+extened||extended
+exteneded||extended
+extensability||extensibility
+extention||extension
+extenstion||extension
+extracter||extractor
+faied||failed
+faield||failed
+faild||failed
+failded||failed
+failer||failure
+faill||fail
+failied||failed
+faillure||failure
+failue||failure
+failuer||failure
+failng||failing
+faireness||fairness
+falied||failed
+faliure||failure
+fallbck||fallback
+familar||familiar
+fatser||faster
+feauture||feature
+feautures||features
+fetaure||feature
+fetaures||features
+fetcing||fetching
+fileystem||filesystem
+fimrware||firmware
+fimware||firmware
+firmare||firmware
+firmaware||firmware
+firtly||firstly
+firware||firmware
+firwmare||firmware
+finanize||finalize
+findn||find
+finilizes||finalizes
+finsih||finish
+fliter||filter
+flusing||flushing
+folloing||following
+followign||following
+followings||following
+follwing||following
+fonud||found
+forseeable||foreseeable
+forse||force
+fortan||fortran
+forwardig||forwarding
+frambuffer||framebuffer
+framming||framing
+framwork||framework
+frequence||frequency
+frequncy||frequency
+frequancy||frequency
+frome||from
+fronend||frontend
+fucntion||function
+fuction||function
+fuctions||functions
+fullill||fulfill
+funcation||function
+funcion||function
+functionallity||functionality
+functionaly||functionally
+functionnality||functionality
+functonality||functionality
+funtion||function
+funtions||functions
+furthur||further
+futhermore||furthermore
+futrue||future
+gatable||gateable
+gateing||gating
+gauage||gauge
+gaurenteed||guaranteed
+generiously||generously
+genereate||generate
+genereted||generated
+genric||generic
+gerenal||general
+geting||getting
+globel||global
+grabing||grabbing
+grahical||graphical
+grahpical||graphical
+granularty||granularity
+grapic||graphic
+grranted||granted
+guage||gauge
+guarenteed||guaranteed
+guarentee||guarantee
+halfs||halves
+hander||handler
+handfull||handful
+hanlde||handle
+hanled||handled
+happend||happened
+hardare||hardware
+harware||hardware
+hardward||hardware
+havind||having
+heirarchically||hierarchically
+heirarchy||hierarchy
+helpfull||helpful
+hearbeat||heartbeat
+heterogenous||heterogeneous
+hexdecimal||hexadecimal
+hybernate||hibernate
+hierachy||hierarchy
+hierarchie||hierarchy
+homogenous||homogeneous
+howver||however
+hsould||should
+hypervior||hypervisor
+hypter||hyper
+idel||idle
+identidier||identifier
+iligal||illegal
+illigal||illegal
+illgal||illegal
+iomaped||iomapped
+imblance||imbalance
+immeadiately||immediately
+immedaite||immediate
+immedate||immediate
+immediatelly||immediately
+immediatly||immediately
+immidiate||immediate
+immutible||immutable
+impelentation||implementation
+impementated||implemented
+implemantation||implementation
+implemenation||implementation
+implementaiton||implementation
+implementated||implemented
+implemention||implementation
+implementd||implemented
+implemetation||implementation
+implemntation||implementation
+implentation||implementation
+implmentation||implementation
+implmenting||implementing
+incative||inactive
+incomming||incoming
+incompaitiblity||incompatibility
+incompatabilities||incompatibilities
+incompatable||incompatible
+incompatble||incompatible
+inconsistant||inconsistent
+increas||increase
+incremeted||incremented
+incrment||increment
+incuding||including
+inculde||include
+indendation||indentation
+indended||intended
+independant||independent
+independantly||independently
+independed||independent
+indiate||indicate
+indicat||indicate
+inexpect||inexpected
+inferface||interface
+infinit||infinite
+infomation||information
+informatiom||information
+informations||information
+informtion||information
+infromation||information
+ingore||ignore
+inital||initial
+initalized||initialized
+initalised||initialized
+initalise||initialize
+initalize||initialize
+initation||initiation
+initators||initiators
+initialiazation||initialization
+initializationg||initialization
+initializiation||initialization
+initialze||initialize
+initialzed||initialized
+initialzing||initializing
+initilization||initialization
+initilize||initialize
+initliaze||initialize
+initilized||initialized
+inofficial||unofficial
+inrerface||interface
+insititute||institute
+instace||instance
+instal||install
+instanciate||instantiate
+instanciated||instantiated
+instuments||instruments
+insufficent||insufficient
+inteface||interface
+integreated||integrated
+integrety||integrity
+integrey||integrity
+intendet||intended
+intented||intended
+interal||internal
+interanl||internal
+interchangable||interchangeable
+interferring||interfering
+interger||integer
+intergrated||integrated
+intermittant||intermittent
+internel||internal
+interoprability||interoperability
+interuupt||interrupt
+interupt||interrupt
+interupts||interrupts
+interrface||interface
+interrrupt||interrupt
+interrup||interrupt
+interrups||interrupts
+interruptted||interrupted
+interupted||interrupted
+intiailized||initialized
+intial||initial
+intialisation||initialisation
+intialised||initialised
+intialise||initialise
+intialization||initialization
+intialized||initialized
+intialize||initialize
+intregral||integral
+intrerrupt||interrupt
+intrrupt||interrupt
+intterrupt||interrupt
+intuative||intuitive
+inavlid||invalid
+invaid||invalid
+invaild||invalid
+invailid||invalid
+invald||invalid
+invalde||invalid
+invalide||invalid
+invalidiate||invalidate
+invalud||invalid
+invididual||individual
+invokation||invocation
+invokations||invocations
+ireelevant||irrelevant
+irrelevent||irrelevant
+isnt||isn't
+isssue||issue
+issus||issues
+iteraions||iterations
+iternations||iterations
+itertation||iteration
+itslef||itself
+ivalid||invalid
+jave||java
+jeffies||jiffies
+jumpimng||jumping
+juse||just
+jus||just
+kown||known
+langage||language
+langauage||language
+langauge||language
+langugage||language
+lauch||launch
+layed||laid
+legnth||length
+leightweight||lightweight
+lengh||length
+lenght||length
+lenth||length
+lesstiff||lesstif
+libaries||libraries
+libary||library
+librairies||libraries
+libraris||libraries
+licenceing||licencing
+limted||limited
+logaritmic||logarithmic
+loggging||logging
+loggin||login
+logile||logfile
+loobpack||loopback
+loosing||losing
+losted||lost
+maangement||management
+machinary||machinery
+maibox||mailbox
+maintainance||maintenance
+maintainence||maintenance
+maintan||maintain
+makeing||making
+mailformed||malformed
+malplaced||misplaced
+malplace||misplace
+managable||manageable
+managament||management
+managment||management
+mangement||management
+manger||manager
+manoeuvering||maneuvering
+manufaucturing||manufacturing
+mappping||mapping
+maping||mapping
+matchs||matches
+mathimatical||mathematical
+mathimatic||mathematic
+mathimatics||mathematics
+maxmium||maximum
+maximium||maximum
+maxium||maximum
+mechamism||mechanism
+mechanim||mechanism
+meetign||meeting
+memeory||memory
+memmber||member
+memoery||memory
+memroy||memory
+ment||meant
+mergable||mergeable
+mesage||message
+mesages||messages
+messags||messages
+messgaes||messages
+messsage||message
+messsages||messages
+metdata||metadata
+micropone||microphone
+microprocesspr||microprocessor
+migrateable||migratable
+millenium||millennium
+milliseonds||milliseconds
+minimim||minimum
+minium||minimum
+minimam||minimum
+minimun||minimum
+miniumum||minimum
+minumum||minimum
+misalinged||misaligned
+miscelleneous||miscellaneous
+misformed||malformed
+mispelled||misspelled
+mispelt||misspelt
+mising||missing
+mismactch||mismatch
+missign||missing
+missmanaged||mismanaged
+missmatch||mismatch
+misssing||missing
+miximum||maximum
+mmnemonic||mnemonic
+mnay||many
+modfiy||modify
+modifer||modifier
+modul||module
+modulues||modules
+momery||memory
+memomry||memory
+monitring||monitoring
+monochorome||monochrome
+monochromo||monochrome
+monocrome||monochrome
+mopdule||module
+mroe||more
+mulitplied||multiplied
+muliple||multiple
+multipler||multiplier
+multidimensionnal||multidimensional
+multipe||multiple
+multple||multiple
+mumber||number
+muticast||multicast
+mutilcast||multicast
+mutiple||multiple
+mutli||multi
+nams||names
+navagating||navigating
+nead||need
+neccecary||necessary
+neccesary||necessary
+neccessary||necessary
+necesary||necessary
+neded||needed
+negaive||negative
+negoitation||negotiation
+negotation||negotiation
+nerver||never
+nescessary||necessary
+nessessary||necessary
+none existent||non-existent
+noticable||noticeable
+notication||notification
+notications||notifications
+notifcations||notifications
+notifed||notified
+notity||notify
+nubmer||number
+numebr||number
+numer||number
+numner||number
+nunber||number
+obtaion||obtain
+obusing||abusing
+occassionally||occasionally
+occationally||occasionally
+occurance||occurrence
+occurances||occurrences
+occurd||occurred
+occured||occurred
+occurence||occurrence
+occure||occurred
+occuring||occurring
+ocurrence||occurrence
+offser||offset
+offet||offset
+offlaod||offload
+offloded||offloaded
+offseting||offsetting
+oflload||offload
+omited||omitted
+omiting||omitting
+omitt||omit
+ommiting||omitting
+ommitted||omitted
+onself||oneself
+onthe||on the
+ony||only
+openning||opening
+operatione||operation
+opertaions||operations
+opportunies||opportunities
+optionnal||optional
+optmizations||optimizations
+orientatied||orientated
+orientied||oriented
+orignal||original
+originial||original
+otherise||otherwise
+ouput||output
+oustanding||outstanding
+overaall||overall
+overhread||overhead
+overlaping||overlapping
+oveflow||overflow
+overflw||overflow
+overlfow||overflow
+overide||override
+overrided||overridden
+overriden||overridden
+overrrun||overrun
+overun||overrun
+overwritting||overwriting
+overwriten||overwritten
+pacakge||package
+pachage||package
+packacge||package
+packege||package
+packge||package
+packtes||packets
+pakage||package
+paket||packet
+pallette||palette
+paln||plan
+palne||plane
+paramameters||parameters
+paramaters||parameters
+paramater||parameter
+parametes||parameters
+parametised||parametrised
+paramter||parameter
+paramters||parameters
+parmaters||parameters
+particuarly||particularly
+particularily||particularly
+partion||partition
+partions||partitions
+partiton||partition
+pased||passed
+passin||passing
+pathes||paths
+pattrns||patterns
+pecularities||peculiarities
+peformance||performance
+peforming||performing
+peice||piece
+pendantic||pedantic
+peprocessor||preprocessor
+perfomance||performance
+perfoming||performing
+perfomring||performing
+periperal||peripheral
+peripherial||peripheral
+permissons||permissions
+permited||permitted
+peroid||period
+persistance||persistence
+persistant||persistent
+phoneticly||phonetically
+plaform||platform
+plalform||platform
+platfoem||platform
+platfrom||platform
+plattform||platform
+pleaes||please
+ploting||plotting
+plugable||pluggable
+poinnter||pointer
+pointeur||pointer
+poiter||pointer
+posible||possible
+positon||position
+possibilites||possibilities
+potocol||protocol
+powerfull||powerful
+pramater||parameter
+preamle||preamble
+preample||preamble
+preapre||prepare
+preceeded||preceded
+preceeding||preceding
+preceed||precede
+precendence||precedence
+precission||precision
+preemptable||preemptible
+prefered||preferred
+prefferably||preferably
+prefitler||prefilter
+preform||perform
+premption||preemption
+prepaired||prepared
+prepate||prepare
+preperation||preparation
+preprare||prepare
+pressre||pressure
+presuambly||presumably
+previosuly||previously
+previsously||previously
+primative||primitive
+princliple||principle
+priorty||priority
+priting||printing
+privilaged||privileged
+privilage||privilege
+priviledge||privilege
+priviledges||privileges
+privleges||privileges
+probaly||probably
+probabalistic||probabilistic
+procceed||proceed
+proccesors||processors
+procesed||processed
+proces||process
+procesing||processing
+processessing||processing
+processess||processes
+processpr||processor
+processsed||processed
+processsing||processing
+procteted||protected
+prodecure||procedure
+progamming||programming
+progams||programs
+progess||progress
+programable||programmable
+programers||programmers
+programm||program
+programms||programs
+progres||progress
+progresss||progress
+prohibitted||prohibited
+prohibitting||prohibiting
+promiscous||promiscuous
+promps||prompts
+pronnounced||pronounced
+prononciation||pronunciation
+pronouce||pronounce
+pronunce||pronounce
+propery||property
+propigate||propagate
+propigation||propagation
+propogation||propagation
+propogate||propagate
+prosess||process
+protable||portable
+protcol||protocol
+protecion||protection
+protedcted||protected
+protocoll||protocol
+promixity||proximity
+psudo||pseudo
+psuedo||pseudo
+psychadelic||psychedelic
+purgable||purgeable
+pwoer||power
+queing||queuing
+quering||querying
+queus||queues
+randomally||randomly
+raoming||roaming
+reasearcher||researcher
+reasearchers||researchers
+reasearch||research
+receieve||receive
+recepient||recipient
+recevied||received
+receving||receiving
+recievd||received
+recieved||received
+recieve||receive
+reciever||receiver
+recieves||receives
+recieving||receiving
+recogniced||recognised
+recognizeable||recognizable
+recommanded||recommended
+recyle||recycle
+redircet||redirect
+redirectrion||redirection
+redundacy||redundancy
+reename||rename
+refcounf||refcount
+refence||reference
+refered||referred
+referenace||reference
+refering||referring
+refernces||references
+refernnce||reference
+refrence||reference
+regiser||register
+registed||registered
+registerd||registered
+registeration||registration
+registeresd||registered
+registerred||registered
+registes||registers
+registraration||registration
+regsiter||register
+regster||register
+regualar||regular
+reguator||regulator
+regulamentations||regulations
+reigstration||registration
+releated||related
+relevent||relevant
+reloade||reload
+remoote||remote
+remore||remote
+removeable||removable
+repectively||respectively
+replacable||replaceable
+replacments||replacements
+replys||replies
+reponse||response
+representaion||representation
+reqeust||request
+reqister||register
+requed||requeued
+requestied||requested
+requiere||require
+requirment||requirement
+requred||required
+requried||required
+requst||request
+requsted||requested
+reregisteration||reregistration
+reseting||resetting
+reseved||reserved
+reseverd||reserved
+resizeable||resizable
+resotre||restore
+resouce||resource
+resouces||resources
+resoures||resources
+responce||response
+resrouce||resource
+ressizes||resizes
+ressource||resource
+ressources||resources
+restesting||retesting
+resumbmitting||resubmitting
+retransmited||retransmitted
+retreived||retrieved
+retreive||retrieve
+retreiving||retrieving
+retrive||retrieve
+retrived||retrieved
+retrun||return
+retun||return
+retuned||returned
+reudce||reduce
+reuest||request
+reuqest||request
+reutnred||returned
+revsion||revision
+rmeoved||removed
+rmeove||remove
+rmeoves||removes
+rountine||routine
+routins||routines
+rquest||request
+runing||running
+runned||ran
+runnnig||running
+runnning||running
+runtine||runtime
+sacrifying||sacrificing
+safly||safely
+safty||safety
+satify||satisfy
+satisifed||satisfied
+savable||saveable
+scaleing||scaling
+scaned||scanned
+scaning||scanning
+scarch||search
+schdule||schedule
+seach||search
+searchs||searches
+secion||section
+secquence||sequence
+secund||second
+segement||segment
+seleted||selected
+semaphone||semaphore
+senario||scenario
+senarios||scenarios
+sentivite||sensitive
+separatly||separately
+sepcify||specify
+seperated||separated
+seperately||separately
+seperate||separate
+seperatly||separately
+seperator||separator
+sepperate||separate
+seqeunce||sequence
+seqeuncer||sequencer
+seqeuencer||sequencer
+sequece||sequence
+sequemce||sequence
+sequencial||sequential
+serivce||service
+serveral||several
+servive||service
+setts||sets
+settting||setting
+shapshot||snapshot
+shoft||shift
+shotdown||shutdown
+shoud||should
+shouldnt||shouldn't
+shoule||should
+shrinked||shrunk
+siginificantly||significantly
+signabl||signal
+significanly||significantly
+similary||similarly
+similiar||similar
+simlar||similar
+simliar||similar
+simpified||simplified
+simultaneusly||simultaneously
+simultanous||simultaneous
+singaled||signaled
+singal||signal
+singed||signed
+slect||select
+sleeped||slept
+sliped||slipped
+softwade||software
+softwares||software
+soley||solely
+souce||source
+speach||speech
+specfic||specific
+specfield||specified
+speciefied||specified
+specifc||specific
+specifed||specified
+specificatin||specification
+specificaton||specification
+specificed||specified
+specifing||specifying
+specifiy||specify
+specifiying||specifying
+speficied||specified
+speicify||specify
+speling||spelling
+spinlcok||spinlock
+spinock||spinlock
+splitted||split
+spreaded||spread
+spurrious||spurious
+sructure||structure
+stablilization||stabilization
+staically||statically
+staion||station
+standardss||standards
+standartization||standardization
+standart||standard
+standy||standby
+stardard||standard
+staticly||statically
+statuss||status
+stoped||stopped
+stoping||stopping
+stoppped||stopped
+straming||streaming
+struc||struct
+structres||structures
+stuct||struct
+strucuture||structure
+stucture||structure
+sturcture||structure
+subdirectoires||subdirectories
+suble||subtle
+substract||subtract
+submited||submitted
+submition||submission
+succeded||succeeded
+suceed||succeed
+succesfuly||successfully
+succesfully||successfully
+succesful||successful
+successed||succeeded
+successfull||successful
+successfuly||successfully
+sucessfully||successfully
+sucessful||successful
+sucess||success
+superflous||superfluous
+superseeded||superseded
+suplied||supplied
+suported||supported
+suport||support
+supportet||supported
+suppored||supported
+supporing||supporting
+supportin||supporting
+suppoted||supported
+suppported||supported
+suppport||support
+supprot||support
+supress||suppress
+surpressed||suppressed
+surpresses||suppresses
+susbsystem||subsystem
+suspeneded||suspended
+suspsend||suspend
+suspicously||suspiciously
+swaping||swapping
+switchs||switches
+swith||switch
+swithable||switchable
+swithc||switch
+swithced||switched
+swithcing||switching
+swithed||switched
+swithing||switching
+swtich||switch
+syfs||sysfs
+symetric||symmetric
+synax||syntax
+synchonized||synchronized
+sychronization||synchronization
+sychronously||synchronously
+synchronuously||synchronously
+syncronize||synchronize
+syncronized||synchronized
+syncronizing||synchronizing
+syncronus||synchronous
+syste||system
+sytem||system
+sythesis||synthesis
+taht||that
+tained||tainted
+tarffic||traffic
+tansmit||transmit
+targetted||targeted
+targetting||targeting
+taskelt||tasklet
+teh||the
+temeprature||temperature
+temorary||temporary
+temproarily||temporarily
+temperture||temperature
+theads||threads
+therfore||therefore
+thier||their
+threds||threads
+threee||three
+threshhold||threshold
+thresold||threshold
+throught||through
+tansition||transition
+trackling||tracking
+troughput||throughput
+trys||tries
+thses||these
+tiggers||triggers
+tiggered||triggered
+tipically||typically
+timeing||timing
+timout||timeout
+tmis||this
+toogle||toggle
+torerable||tolerable
+torlence||tolerance
+traget||target
+traking||tracking
+tramsmitted||transmitted
+tramsmit||transmit
+tranasction||transaction
+tranceiver||transceiver
+tranfer||transfer
+tranmission||transmission
+transcevier||transceiver
+transciever||transceiver
+transferd||transferred
+transfered||transferred
+transfering||transferring
+transision||transition
+transistioned||transitioned
+transmittd||transmitted
+transormed||transformed
+trasfer||transfer
+trasmission||transmission
+treshold||threshold
+triggerd||triggered
+trigerred||triggered
+trigerring||triggering
+trun||turn
+tunning||tuning
+ture||true
+tyep||type
+udpate||update
+updtes||updates
+uesd||used
+unknwon||unknown
+uknown||unknown
+usccess||success
+uncommited||uncommitted
+uncompatible||incompatible
+unconditionaly||unconditionally
+undeflow||underflow
+undelying||underlying
+underun||underrun
+unecessary||unnecessary
+unexecpted||unexpected
+unexepected||unexpected
+unexpcted||unexpected
+unexpectd||unexpected
+unexpeted||unexpected
+unexpexted||unexpected
+unfortunatelly||unfortunately
+unifiy||unify
+uniterrupted||uninterrupted
+uninterruptable||uninterruptible
+unintialized||uninitialized
+unitialized||uninitialized
+unkmown||unknown
+unknonw||unknown
+unknouwn||unknown
+unknow||unknown
+unkown||unknown
+unamed||unnamed
+uneeded||unneeded
+unneded||unneeded
+unneccecary||unnecessary
+unneccesary||unnecessary
+unneccessary||unnecessary
+unnecesary||unnecessary
+unneedingly||unnecessarily
+unnsupported||unsupported
+unuspported||unsupported
+unmached||unmatched
+unprecise||imprecise
+unpriviledged||unprivileged
+unpriviliged||unprivileged
+unregester||unregister
+unresgister||unregister
+unrgesiter||unregister
+unsinged||unsigned
+unstabel||unstable
+unsolicted||unsolicited
+unsolicitied||unsolicited
+unsuccessfull||unsuccessful
+unsuported||unsupported
+untill||until
+ununsed||unused
+unuseful||useless
+unvalid||invalid
+upate||update
+upsupported||unsupported
+upto||up to
+useable||usable
+usefule||useful
+usefull||useful
+usege||usage
+usera||users
+usualy||usually
+usupported||unsupported
+utilites||utilities
+utillities||utilities
+utilties||utilities
+utiltity||utility
+utitity||utility
+utitlty||utility
+vaid||valid
+vaild||valid
+valide||valid
+variantions||variations
+varible||variable
+varient||variant
+vaule||value
+verbse||verbose
+veify||verify
+verfication||verification
+veriosn||version
+verisons||versions
+verison||version
+veritical||vertical
+verson||version
+vicefersa||vice-versa
+virtal||virtual
+virtaul||virtual
+virtiual||virtual
+visiters||visitors
+vitual||virtual
+vunerable||vulnerable
+wakeus||wakeups
+was't||wasn't
+wathdog||watchdog
+wating||waiting
+wiat||wait
+wether||whether
+whataver||whatever
+whcih||which
+whenver||whenever
+wheter||whether
+whe||when
+wierd||weird
+wihout||without
+wiil||will
+wirte||write
+withing||within
+wnat||want
+wont||won't
+workarould||workaround
+writeing||writing
+writting||writing
+wtih||with
+zombe||zombie
+zomebie||zombie
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC 2/3] scripts/checkpatch: Add --codespell and --codespellfile options
  2023-12-04  8:29 [RFC 0/3] scripts/checkpatch: Add code spelling check Zhao Liu
  2023-12-04  8:29 ` [RFC 1/3] scripts/checkpatch: Check common spelling be default Zhao Liu
@ 2023-12-04  8:29 ` Zhao Liu
  2023-12-04  8:29 ` [RFC 3/3] scripts/spelling: Add common spelling mistakes in default spelling.txt Zhao Liu
  2 siblings, 0 replies; 6+ messages in thread
From: Zhao Liu @ 2023-12-04  8:29 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, Philippe Mathieu-Daudé,
	Paolo Bonzini, Thomas Huth, Richard Henderson, qemu-devel
  Cc: qemu-trivial, Zhenyu Wang, Zhao Liu

From: Zhao Liu <zhao1.liu@intel.com>

Add two spelling check options (--codespell and --codespellfile) to
enhance spelling check through dictionary, which copied the Linux
kernel's implementation in checkpatch.pl.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 scripts/checkpatch.pl | 66 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 65 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 755a1f683866..20ee07f016ca 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -38,7 +38,10 @@ my $summary_file = 0;
 my $root;
 my %debug;
 my $help = 0;
+my $codespell = 0;
 my $spelling_file = "$D/spelling.txt";
+my $codespellfile = "/usr/share/codespell/dictionary.txt";
+my $user_codespellfile = "";
 
 sub help {
 	my ($exitcode) = @_;
@@ -70,6 +73,9 @@ Options:
                              is all off)
   --test-only=WORD           report only warnings/errors containing WORD
                              literally
+  --codespell                Use the codespell dictionary for spelling/typos
+                             (default:$codespellfile)
+  --codespellfile            Use this codespell dictionary
   --color[=WHEN]             Use colors 'always', 'never', or only when output
                              is a terminal ('auto'). Default is 'auto'.
   -h, --help, --version      display this help and exit
@@ -102,15 +108,37 @@ GetOptions(
 	'summary!'	=> \$summary,
 	'mailback!'	=> \$mailback,
 	'summary-file!'	=> \$summary_file,
-
 	'debug=s'	=> \%debug,
 	'test-only=s'	=> \$tst_only,
+	'codespell!'	=> \$codespell,
+	'codespellfile=s'	=> \$user_codespellfile,
 	'color=s'       => \$color,
 	'no-color'      => sub { $color = 'never'; },
 	'h|help'	=> \$help,
 	'version'	=> \$help
 ) or help(1);
 
+if ($user_codespellfile) {
+	# Use the user provided codespell file unconditionally
+	$codespellfile = $user_codespellfile;
+} elsif (!(-f $codespellfile)) {
+	# If /usr/share/codespell/dictionary.txt is not present, try to find it
+	# under codespell's install directory: <codespell_root>/data/dictionary.txt
+	if (($codespell || $help) && which("python3") ne "") {
+		my $python_codespell_dict = << "EOF";
+
+import os.path as op
+import codespell_lib
+codespell_dir = op.dirname(codespell_lib.__file__)
+codespell_file = op.join(codespell_dir, 'data', 'dictionary.txt')
+print(codespell_file, end='')
+EOF
+
+		my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`;
+		$codespellfile = $codespell_dict if (-f $codespell_dict);
+	}
+}
+
 help(0) if ($help);
 
 my $exit = 0;
@@ -364,6 +392,30 @@ if (open(my $spelling, '<', $spelling_file)) {
 	warn "No typos will be found - file '$spelling_file': $!\n";
 }
 
+if ($codespell) {
+	if (open(my $spelling, '<', $codespellfile)) {
+		while (<$spelling>) {
+			my $line = $_;
+
+			$line =~ s/\s*\n?$//g;
+			$line =~ s/^\s*//g;
+
+			next if ($line =~ m/^\s*#/);
+			next if ($line =~ m/^\s*$/);
+			next if ($line =~ m/, disabled/i);
+
+			$line =~ s/,.*$//;
+
+			my ($suspect, $fix) = split(/->/, $line);
+
+			$spelling_fix{$suspect} = $fix;
+		}
+		close($spelling);
+	} else {
+		warn "No codespell typos will be found - file '$codespellfile': $!\n";
+	}
+}
+
 $misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix;
 
 # This can be modified by sub possible.  Since it can be empty, be careful
@@ -506,6 +558,18 @@ sub top_of_kernel_tree {
 	return 1;
 }
 
+sub which {
+	my ($bin) = @_;
+
+	foreach my $path (split(/:/, $ENV{PATH})) {
+		if (-e "$path/$bin") {
+			return "$path/$bin";
+		}
+	}
+
+	return "";
+}
+
 sub expand_tabs {
 	my ($str) = @_;
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC 3/3] scripts/spelling: Add common spelling mistakes in default spelling.txt
  2023-12-04  8:29 [RFC 0/3] scripts/checkpatch: Add code spelling check Zhao Liu
  2023-12-04  8:29 ` [RFC 1/3] scripts/checkpatch: Check common spelling be default Zhao Liu
  2023-12-04  8:29 ` [RFC 2/3] scripts/checkpatch: Add --codespell and --codespellfile options Zhao Liu
@ 2023-12-04  8:29 ` Zhao Liu
  2 siblings, 0 replies; 6+ messages in thread
From: Zhao Liu @ 2023-12-04  8:29 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, Philippe Mathieu-Daudé,
	Paolo Bonzini, Thomas Huth, Richard Henderson, qemu-devel
  Cc: qemu-trivial, Zhenyu Wang, Zhao Liu

From: Zhao Liu <zhao1.liu@intel.com>

Select the typos in commits from 7.0.0 to 8.2.0-rc2 that were typed more
than three times to add to the default dictionary selling.txt.

The typos were counted by (Referenced Kees' command in Linux kernel's
commit 66b47b4a9dad00):

$ git log --format='%H' v7.0.0..v8.2.0-rc2 | \
   while read commit ; do \
     echo "commit $commit" ; \
     git log --format=email --stat -p -1 $commit | \
     ./scripts/checkpatch.pl --codespell - ; \
   done | \
   tee spell_v7.0.0..v8.2.0-rc2.txt | \
   grep "may be misspelled" | awk '{print $2}' | \
   tr A-Z a-z | sort | uniq -c | sort -rn

The typos were listed as follows (In addition to variable naming and
misreporting, select typos greater than three times):

   1289 'fpr'
    222 'ot'
     45 'hace'
     25 'te'
     24 'parm'
     21 'sie'
     20 'nd'
     20 'clen'
     15 'sring'
     14 'hax'
     13 'hda'
     12 'endianess'
     10 'tabl'
     10 'stip'
     10 'datas'
      9 'reenable'
      8 'unitialized'
      8 'invers'
      7 'seh'
      7 'priviledge'
      7 'indentification'
      7 'existance'
      6 'varience'
      6 'unuseful'
      6 'tranfer'
      6 'tne'
      6 'octects'
      6 'informations'
      6 'indicies'
      6 'extenstion'
      6 'betwen'
      6 'ammends'
      5 'writting'
      5 'wont'
      5 'som'
      5 'responsability'
      5 'padd'
      5 'offsetp'
      5 'negotation'
      5 'necesary'
      5 'nam'
      5 'maintainance'
      5 'extnesion'
      5 'convertion'
      5 'configuraiton'
      5 'comparision'
      5 'arbitrer'
      5 'an
      5 'algorithim'
      5 'addreses'
      5 'achived'
      5 'accomodate'
      4 'undocummented'
      4 'ue'
      4 'truely'
      4 'tre'
      4 'suppoted'
      4 'separatly'
      4 'reenabled'
      4 'occured'
      4 'myu'
      4 'mone'
      4 'ment'
      4 'limitaions'
      4 'instread'
      4 'infomation'
      4 'implment'
      4 'hammmer'
      4 'desciptor'
      4 'defintions'
      4 'crypted'
      4 'constext'
      4 'acces'
      3 'wronly'
      3 'wether'
      3 'vill'
      3 'unsupport'
      3 'unneded'
      3 'transfered'
      3 'sxl'
      3 'suppor'
      3 'superceded'
      3 'succesfully'
      3 'slighly'
      3 'setted'
      3 'respectivelly'
      3 'reigster'
      3 'recive'
      3 'priviledged'
      3 'potentialy'
      3 'phyiscal'
      3 'pathes'
      3 'othe'
      3 'ontaining'
      3 'nunber'
      3 'missmatch'
      3 'minumum'
      3 'mesage'
      3 'legnth'
      3 'kenel'
      3 'intialized'
      3 'inbetween'
      3 'implemetation'
      3 'garanteed'
      3 'explictly'
      3 'enhacements'
      3 'ealier'
      3 'doen't'
      3 'diferent'
      3 'debuging'
      3 'daa'
      3 'convergance'
      3 'compatiblity'
      3 'caf'
      3 'buid'
      3 'becase'
      3 'bandwith'
      3 'atleast'
      3 'asume'
      3 'analoguous'
      3 'alse'
      3 'addtionally'
      3 'addtional'
      3 'addresss'
      3 'acknowledgement'
      3 'accross'
      3 'acceses'

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 scripts/spelling.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/scripts/spelling.txt b/scripts/spelling.txt
index 549ffd0f2d78..177dee2bb28d 100644
--- a/scripts/spelling.txt
+++ b/scripts/spelling.txt
@@ -28,6 +28,7 @@ accelaration||acceleration
 accelearion||acceleration
 acceleratoin||acceleration
 accelleration||acceleration
+acces||access
 accesing||accessing
 accesnt||accent
 accessable||accessible
@@ -50,6 +51,7 @@ acessable||accessible
 acess||access
 acessing||accessing
 achitecture||architecture
+achived||achieved
 acient||ancient
 acitions||actions
 acitve||active
@@ -95,6 +97,7 @@ albumns||albums
 alegorical||allegorical
 algined||aligned
 algorith||algorithm
+algorithim||algorithm
 algorithmical||algorithmically
 algoritm||algorithm
 algoritms||algorithms
@@ -124,6 +127,7 @@ altough||although
 alue||value
 ambigious||ambiguous
 ambigous||ambiguous
+ammend||amend
 amoung||among
 amount of times||number of times
 amout||amount
@@ -248,6 +252,7 @@ beeing||being
 befor||before
 begining||beginning
 beter||better
+betwen||between
 betweeen||between
 bianries||binaries
 bitmast||bitmask
@@ -350,6 +355,7 @@ comsuming||consuming
 comaptible||compatible
 compability||compatibility
 compaibility||compatibility
+comparision||comparison
 comparsion||comparison
 compatability||compatibility
 compatable||compatible
@@ -385,6 +391,7 @@ configred||configured
 configuartion||configuration
 configuation||configuration
 configued||configured
+configuraiton||configuration
 configuratoin||configuration
 configuraton||configuration
 configuretion||configuration
@@ -658,6 +665,7 @@ exteneded||extended
 extensability||extensibility
 extention||extension
 extenstion||extension
+extnesion||extension
 extracter||extractor
 faied||failed
 faield||failed
@@ -796,6 +804,7 @@ implementd||implemented
 implemetation||implementation
 implemntation||implementation
 implentation||implementation
+implment||implement
 implmentation||implementation
 implmenting||implementing
 incative||inactive
@@ -812,11 +821,13 @@ incuding||including
 inculde||include
 indendation||indentation
 indended||intended
+indentification||identification
 independant||independent
 independantly||independently
 independed||independent
 indiate||indicate
 indicat||indicate
+indicies||indices
 inexpect||inexpected
 inferface||interface
 infinit||infinite
@@ -850,6 +861,7 @@ instace||instance
 instal||install
 instanciate||instantiate
 instanciated||instantiated
+instread||instead
 instuments||instruments
 insufficent||insufficient
 inteface||interface
@@ -934,6 +946,7 @@ libary||library
 librairies||libraries
 libraris||libraries
 licenceing||licencing
+limitaion||limitation
 limted||limited
 logaritmic||logarithmic
 loggging||logging
@@ -1331,6 +1344,7 @@ resouce||resource
 resouces||resources
 resoures||resources
 responce||response
+responsability||responsibility
 resrouce||resource
 ressizes||resizes
 ressource||resource
@@ -1554,6 +1568,7 @@ throught||through
 tansition||transition
 trackling||tracking
 troughput||throughput
+truely||truly
 trys||tries
 thses||these
 tiggers||triggers
@@ -1623,6 +1638,7 @@ unknouwn||unknown
 unknow||unknown
 unkown||unknown
 unamed||unnamed
+undocummented||undocumented
 uneeded||unneeded
 unneded||unneeded
 unneccecary||unnecessary
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RFC 1/3] scripts/checkpatch: Check common spelling be default
  2023-12-04  8:29 ` [RFC 1/3] scripts/checkpatch: Check common spelling be default Zhao Liu
@ 2023-12-04  9:07   ` Thomas Huth
  2023-12-05  3:24     ` Zhao Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Huth @ 2023-12-04  9:07 UTC (permalink / raw)
  To: Zhao Liu, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé, Paolo Bonzini, Richard Henderson,
	qemu-devel
  Cc: qemu-trivial, Zhenyu Wang, Zhao Liu

On 04/12/2023 09.29, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> Add the check for common spelling mistakes for QEMU, which stole
> selling.txt from Linux kernel and referenced the Linux kernel's

You need to sellcheck^Wspellcheck the above line ;-)

> implementation in checkpatch.pl.
> 
> This check covers common spelling mistakes, and can be updated/
> extended as per QEMU's realities.
> 
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   scripts/checkpatch.pl |   44 ++
>   scripts/spelling.txt  | 1713 +++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 1757 insertions(+)
>   create mode 100644 scripts/spelling.txt

I like the idea of having spellchecking in checkpatch.pl ... not sure though 
if we need both, this patch and support for codespell. If you ask me, I'd 
just go with the next codespell patch and avoid adding a full spelling.txt 
file here ... but if others like this patch here, too, I'm also fine with it.

  Thomas



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC 1/3] scripts/checkpatch: Check common spelling be default
  2023-12-04  9:07   ` Thomas Huth
@ 2023-12-05  3:24     ` Zhao Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Zhao Liu @ 2023-12-05  3:24 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Michael Tokarev, Laurent Vivier, Philippe Mathieu-Daudé,
	Paolo Bonzini, Richard Henderson, qemu-devel, qemu-trivial,
	Zhenyu Wang, Zhao Liu

Hi Thomas,

On Mon, Dec 04, 2023 at 10:07:12AM +0100, Thomas Huth wrote:
> Date: Mon, 4 Dec 2023 10:07:12 +0100
> From: Thomas Huth <thuth@redhat.com>
> Subject: Re: [RFC 1/3] scripts/checkpatch: Check common spelling be default
> 
> On 04/12/2023 09.29, Zhao Liu wrote:
> > From: Zhao Liu <zhao1.liu@intel.com>
> > 
> > Add the check for common spelling mistakes for QEMU, which stole
> > selling.txt from Linux kernel and referenced the Linux kernel's
> 
> You need to sellcheck^Wspellcheck the above line ;-)

Oh no, I didn't expect this place to be wrong...--codespelling isn't
infallible!

> 
> > implementation in checkpatch.pl.
> > 
> > This check covers common spelling mistakes, and can be updated/
> > extended as per QEMU's realities.
> > 
> > Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> > ---
> >   scripts/checkpatch.pl |   44 ++
> >   scripts/spelling.txt  | 1713 +++++++++++++++++++++++++++++++++++++++++
> >   2 files changed, 1757 insertions(+)
> >   create mode 100644 scripts/spelling.txt
> 
> I like the idea of having spellchecking in checkpatch.pl 

Thanks!

> ... not sure though
> if we need both, this patch and support for codespell. If you ask me, I'd
> just go with the next codespell patch and avoid adding a full spelling.txt
> file here ... but if others like this patch here, too, I'm also fine with
> it.

OK, I'll wait a few days to see if anyone else has any comments, if not
I'll refresh a V2 and just keep the next patch.

Regards,
Zhao



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-05  3:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-04  8:29 [RFC 0/3] scripts/checkpatch: Add code spelling check Zhao Liu
2023-12-04  8:29 ` [RFC 1/3] scripts/checkpatch: Check common spelling be default Zhao Liu
2023-12-04  9:07   ` Thomas Huth
2023-12-05  3:24     ` Zhao Liu
2023-12-04  8:29 ` [RFC 2/3] scripts/checkpatch: Add --codespell and --codespellfile options Zhao Liu
2023-12-04  8:29 ` [RFC 3/3] scripts/spelling: Add common spelling mistakes in default spelling.txt Zhao Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).