<commit_before>result :=  SortedCollection sortBlock: [:a :b| a name size > b name size].
validMethods := MooseModel root first allModelMethods reject: [ :each |
	each isStub 
		or: [ ('*.*' match: each name) 
			or: [ ('test*' match: each name )
				or: [ each isConstructor ] ] ] ].

(validMethods copyFrom: 1 to: 10) do: [ :e| result add: e ].


validMethods do: [ :each |
		each name size > (result at: 10) name size ifTrue: [ 
					result removeAt: 10.
					result add: each.
				] ].
	

(result collect: #name )do: [ :name |
	UnixProcess stdOut 
		nextPutAll: MooseModel root first name;
		nextPutAll: ', ';
		nextPutAll: name;
		cr;lf.
		].

Smalltalk snapshot: false andQuit: true.<commit_msg>refactoring of the longest-method-names methods<commit_after>"Filter out uninteresting methods (e.g. test cases, constructors)"
interestingMethods := MooseModel root first allModelMethods reject: [ :each |
	each isStub 
		or: [ ('*.*' match: each name) 
			or: [ ('test*' match: each name )
				or: [ each isConstructor ] ] ] ].

"Initialize the top10"
top10 :=  SortedCollection sortBlock: [:a :b| a name size > b name size].
(interestingMethods copyFrom: 1 to: 10) do: [ :e| top10 add: e ].

"Iterate over all the methods always keeping the interesting ones in top"
interestingMethods do: [ :each |
		each name size > (top10 at: 10) name size ifTrue: [ 
					top10 removeAt: 10.
					top10 add: each.
				] ].
	
"Print out the results"
(top10 collect: #name )do: [ :name |
	UnixProcess stdOut 
		nextPutAll: MooseModel root first name;
		nextPutAll: ', ';
		nextPutAll: name;
		cr;lf.
		].

Smalltalk snapshot: false andQuit: true.
{'fraction_non_alphanumeric': 0.1266829865361077, 'fraction_numerical': 0.017135862913096694, 'mean_word_length': 3.4672131147540983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '735945', 'n_tokens_mistral': 632, 'n_tokens_neox': 551, 'n_words': 192}