Repository navigation
Conversation
|
Important Review skippedToo many files! This PR contains 488 files, which is 388 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files. ⚙️ Run configuration
⛔ Files ignored due to path filters: 1
📒 Files selected for processing: 488
You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/counts-bounds-and-enclosure-result #975 +/- ##
=========================================================================
Coverage ? 96.86%
=========================================================================
Files ? 444
Lines ? 89966
Branches ? 0
=========================================================================
Hits ? 87150
Misses ? 2816
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Numerical conformance1893/1893 checks pass across 111 domains and 523 standards (227 normative designations, 125 further published sources). Used in the tables below is how much of that clause's published tolerance the deviation consumes: 100 % sits exactly on the limit, 5 % uses a twentieth of the allowance, and a dash means the clause states no two-sided tolerance for the quantity, so there is no budget to spend. It is reported and never used to decide a verdict, which is settled at full precision before any rounding. Renamed (3)
Closest to their published limit (top 5) The rows with the least room left, so the ones a change is most likely to push over.
|
A level and a level difference are in decibels by definition, yet the public names spelled them both ways: about 400 names ended in `_db` (`insertion_loss_db`, `band_levels_db`, `sound_reduction_index_db`) beside as many that did not, often the same concept in two modules (`background_levels_db` against `background_levels`, `insertion_loss_db` against `insertion_loss`, `c_db` on a joint rating against `c` on every other ISO 717 rating, `tonal_adjustment_db` on the wind turbine rating level against the bare `adjustment` of the tonal and impulsive assessments). A caller had to remember which module had chosen which.
388fe91 to
5ffddef
Compare
[Medium impact] Removes unit suffixes from field names across the codebase. The PR appears safe to merge, with a non-blocking gap in the new naming check. Findings
Reviews (1) · Last reviewed commit: "A level or a level difference carries no..." · Reviewed by Greptile |
| entries = list(public_names()) | ||
| known = {(e.module, e.qualname, e.name) for e in entries} | ||
| for entry in _public_functions(): | ||
| owner, _, name = entry.qualname.rpartition(".") | ||
| if (entry.module, owner, name) not in known: | ||
| entries.append(PublicName(entry.module, owner, name, entry.where)) |
There was a problem hiding this comment.
Inherited properties escape the check
decibel_suffixed() misses properties inherited from an unpublished base class. public_names() reads only the exported class's own members, while _public_functions() adds inherited methods but excludes properties. An inherited insertion_loss_db property therefore passes the new check, leaving contributors without the promised warning. Walk inherited properties too, and add a regression test beside the inherited-method test.
There was a problem hiding this comment.
Fixed in #992, commit b093916. One walk of the method resolution order now serves the members, the properties, the methods and the public names, each named by the class that defines it. Two tests plant a property and a method on _DrawableLayer and see them reported once; the tree is clean under the wider walk.
|



A level and a level difference are in decibels by definition, yet the public names spelled them both ways: about 400 names ended in
_db(insertion_loss_db,band_levels_db,sound_reduction_index_db) beside as many that did not, often the same concept in two modules (background_levels_dbagainstbackground_levels,insertion_loss_dbagainstinsertion_loss,c_dbon a joint rating againstcon every other ISO 717 rating,tonal_adjustment_dbon the wind turbine rating level against the bareadjustmentof the tonal and impulsive assessments). A caller had to remember which module had chosen which.What changes
The rule is the head noun. A public name whose head noun is a level (
level,levels,spl) or a level difference (a loss, an insulation, an isolation, a reduction, a rejection, a difference, an improvement, a single-value attenuation, a correction, an adjustment, an index, an emergence, the spectrum adaptation term of ISO 717, or a shift, an increase, a decrease or an excess of a level the name names), or the printed symbol of one, as its first word or as its head (l_n,delta_lw; inbuildingr_s_w,d_2m_nt,c,ctrand the vibration reduction index Kij,k_ijorkij; inemissionthe corrections C1 to C3 and K1 to K3), carries no_db, whatever it is: a parameter, a field, a property, a method or a constant. The head noun is the last noun once the words that qualify it from behind are set aside (a band_1000, a weighting_a,_before/_after,_with/_without,_max/_min), or the noun before a phrase that follows it (band_levels_at_characteristic). A name whose head noun does not say decibel keeps the suffix: a tolerance, a margin, a limit not itself named a level, an uncertainty, a deviation, a step, a slope (_db_per_decade), a rate (_db_per_m), a ratio (signal_to_noise_ratio_db), a statistic of a level (sigma_level_db), a difference of another quantity (diffuse_pressure_difference_db, where "pressure" would read as pascals), and a shift or a drop that names no level (allowed_threshold_shift_db).Every hit moved with every caller: src,
_plotand_report, the tests and their fixtures, the conformance domains, the figure and report scripts,api_taxonomy.py, the curated API table, the errata, the guides in English and Spanish and theirdocs/mirrors. The banded catalogue rows move their columns too (transmission_loss_500,sound_reduction_index_1000,impact_improvement_125), in the JSON data files, the column specs ofgenerate_catalogue_data.py, the site's catalogue data and schema and the published-catalogue baseline, and the methods that read a band off them follow (TransmissionLossSpectrum.transmission_loss(500));LoopField.level(component)andTimeSelectiveResponse.level_at(t)lose theirs as well. The corrections written as their printed symbols follow: the cap on the local environmental correction K3 of ISO 11202 isemission.MAX_K3and its grade 2 boundGRADE_2_MAX_K3, the floor on the multi-junction Kij of EN 12354-5 isbuilding.MIN_MULTI_JUNCTION_KIJ(beside thek_ijandkij_minthe building prediction already wrote bare), and the C1, C2 and C3 of an ISO 6926 calibration areReferenceSourceCalibration.c1,c2andc3, withreference_source_calibration(c2=...)for the manufacturer's C2, as every other sound power result ofemissionalready wrote them. The emergence of IEC TS 61400-11-2 Annex J, the ambient level less the residual one (Equation (J.1)), isSoundEmergence.emergence, so the record now readsambient_levels,background_levelsandemergencealike, as doTurbineSoundLevelsandMicrophoneTraverse.LaboratoryJointInsulationResult.r_s_primeholds R_s', primed as the tree writes R' (r_prime), becauser_s_measuredreads as a verdict flag to the stored-verdict test.An adjustment is a quantity added to a level (ISO 1996-1:2016, 3.3.1, PDF page 10, printed page 4), so it is a level difference like a correction:
wind_turbine_rating_leveltakestonal_adjustment,amplitude_modulation_adjustmentandimpulsive_adjustment,WindTurbineRatingLevelholdsadjustments,long_term_seltakesrating_adjustment, andAdjustmentValue.adjustmentandsensitivity_adjustmentof the free-field corrections lose their suffix, matching theadjustmentthe tonal and impulsive assessments already wrote. The isolation of an earmuff test fixture (FixtureIsolationCheck.isolation, the open level less the level under the cup), the free-field rejection of an REAT sound field (REATSoundFieldCheck.free_field_rejection, with thefree_field_rejection=parameter ofallowable_field_variationandcheck_reat_sound_field), the rise and fall of a quadrature phase error (QuadraturePhaseError.level_increase,level_decrease), the shift of an SEL distribution (SELDistribution.level_shift) and the excess levels of a spatial decay (SpatialDecayResult.level_excessandmean_level_excess, the names of the functions that compute them) follow. None of these shipped in 3.3.0 or 4.0.0rc1.The E DIN 45672-3 transfer functions return level differences, which is what the draft calls them: Annex A is titled "Pegeldifferenzspektren der Baugrund-Fundament-Decke-Übertragung" and Table A.1 prints "Pegeldifferenzspektren ΔL_v,DB(f_Tn) in dB" (E DIN 45672-3:2023-02, PDF page 24, printed page 24). They are named for it:
ground_to_floor_level_difference,ground_to_foundation_level_difference,foundation_to_floor_level_difference, with their tablesGROUND_TO_FLOOR_LEVEL_DIFFERENCES,GROUND_TO_FOUNDATION_LEVEL_DIFFERENCESandFOUNDATION_TO_FLOOR_LEVEL_DIFFERENCES. "Transfer" stays for the dimensionless ratios of DIN 4150-1.A notebook table read the unit of a field from its suffix, so a renamed level would have lost its dB. It now reads the same head noun, beside a real number only: a bare level or level difference that holds a number shows dB, which also gives the 230 bare level fields that showed no unit before (
IntensityResult.pressure_level,SonarEquationResult.propagation_loss,ReductionImprovementRating.delta_rw) theirs, and the symbols show dB where their package prints them (the C1 and C2 of the sound power results,VibrationReductionResult.k_ij,FacadePredictionResult.element_r). A truth value, a text, a complex factor or a record under such a name shows no unit:OperatingCondition.max_levelis a flag,RegulationLimits.indexa label,SphericalGroundResult.boundary_lossthe complex factor F(w),FreeFieldArrangementCheck.air_attenuationa record. A loudness level shows phon, which is its unit (ISO 532-1:2017, 3.16, Note 1), onZwickerLoudness,MooreGlasbergLoudnessandMooreGlasbergTimeVaryingLoudness. The lengths l1 and l2 of ASTM E2611 are metres inmaterials, for the table and for the unit guard. The numbers the head noun would misread say their own unit in_display_units: the reflection index and gain corrections of EN 1793-5 (ratios of energies; Table 1 prints no unit for RI_j and "-" for C_gain,k), the A_eta of IEC 60534-8-3 namedefficiency_correction(dimensionless in Clause 4, used as10**efficiency_correction), the bias factor kΔr/sin(kΔr) ofIntensityResult, the mean of an envelope spectrum, a path difference in metres, an end-correction factor, a just-noticeable difference in the unit of its quantity, the delta-IIC class difference and two sample indices.Kept on purpose, each keyed by location with its reason in
LEVEL_SUFFIX_EXEMPT:CouplerTransferImpedance.capillary_correction_db, the level of the complex factor the record holds ascapillary_correction; andInsertionLossUncertaintyBudget.open_level_dbandoccluded_level_db, standard uncertainties named for the input of ISO 4869-3 Table B.1 they belong to. The maximum and minimum levels lose it under theirmax_/min_spelling as well: the statistical pass-by, the reference sound source calibration andcheck_measurement_disturbancetakemax_levels,FieldStrengthReadingandPassByMeasurementholdmax_level,plant_steady_readingtakesmax_levelandmin_level,check_varying_backgroundtakesbackground_max_level, andTrainPassageholdsband_max_levels.What breaks
Every renamed name is gone under its old spelling, with no alias. The names that shipped in 3.3.0 or 4.0.0rc1 (the microphone and loudspeaker characteristics,
QuasiPeakResult.level, the window metrics, the synchronous average and the resampler, the ISO 11200-series emission sound pressure level and its corrections (K1, and the K3 of ISO 11202 and ISO 11204),MODAL_FILTER_ATTENUATION,MAX_K3andGRADE_2_MAX_K3,airborne_insulation_rating) are in a new section of the migration guide, in its three copies; the rest are newer than rc1, and the CHANGELOG entries written since rc1 now name them as they are. The rc1MINIMUM_MULTI_JUNCTION_KIJrow maps straight toMIN_MULTI_JUNCTION_KIJ, and the CHANGELOG entry on constants that carry their unit counts sixty-four of them and says that_DBcloses a constant in decibels only when its name does not already name a level or a level difference. In a notebook table a loudness level now shows phon, where 4.0.0rc1 showed no unit. The counts at the top of the guide do not move: no name the 3.3.0 top level exported changes. CONTRIBUTING has a Levels row with the criterion, and its notebook paragraph says when the table shows dB, phon or nothing.How it was verified
No number moves.
make conformanceleavesdocs/CONFORMANCE.mdbyte-identical (1893/1893 checks pass across 111 domains), every figure the renamed code draws regenerates byte-identical, and the full suite passes on the remote gate.Every cell of Tables A.1 to A.6 of E DIN 45672-3 is now checked against a transcription of the draft kept in
tests/reference_data/din45672_3_annex_a.py, apart from the library's tables; Tables A.3 and A.4 were read again on PDF page 26, printed page 26. Changing the first cell of the 12,5 Hz concrete column from -1,48 to -1,58 failstest_every_cell_of_the_ground_to_floor_tables_is_the_printed_one[concrete-table0]; adding 3 dB to the isolation ofverify_fixture_isolationfailstest_the_fixture_isolation_is_the_open_level_less_the_cup_level, whose 62 dB band sits between the 55 dB and 65 dB requirements. Both were open before this change.tests/test_record_display.pywalks every public record and fails on a flag, a text, a complex value or a record field the table would label dB, and on any_display_unitsentry that is not a field, that the name would not need, or that the table does not show. Each half fails when its code is taken out:The check that a published field type is published too now reads a published record instance (
DEFAULT_EXPANDER) through its class, since an instance carries no module globals and the_display_unitsannotation ofExpandercould not resolve from it. Two error-message checks now quote the message they pin ("'r_s' must be the correction","'level' must be finite"), so an error aboutr_s_primeorr_s_maxno longer satisfies the first.The guard
scripts/check_parameter_units.pygains a rule: a public name whose head noun says decibel and that ends in_db(or carries it before a qualifier,level_db_at) is reported with the name it reads as without it. It reads every name a caller writes, the parameters, fields, properties, methods, functions and constants, through the same walk of the imported package as the other unit rules. A printed symbol is read as the first word of a name or as its head, in the package where it says decibel (max_k3inemission,min_multi_junction_kijinbuilding; ac1inunderwateris a sound speed and ac_dbthere the gain of a weighting, and anl1inmaterialsa length). A change noun (shift, increase, decrease, excess, drop, rise, change, increment) says decibel only after a level word, solevel_shift_dbis reported andallowed_threshold_shift_dbordrop_dbis not; an adjustment, an isolation or a rejection reads like a loss, sotemperature_adjustment_dbkeeps its unit. The unit rule beside it reads the head noun too, so a bareinsertion_lossorpressure_level_differencedeclares its unit, while a difference noun after another quantity does not: a barephase_difference,pressure_lossorplateau_heightholding decibels still fails as a quantity without its unit, as it did before.tests/test_check_parameter_units.pypins both halves (names that carry no_db, names that keep it, nouns that declare the decibel and nouns that do not, a level put back with its_db, a decibel value put back bare under another noun, a stale exemption, and the notebook table reading levels the way the rule does), andtests/test_removed_names.pypins a sample of the shipped spellings as gone.Red on the base, the guard of this branch run against
fix/counts-bounds-and-enclosure-result(818b515), exit 1:Green on the branch:
make parameter-unitsprints "Every public parameter and constant under the rule names its unit, in the one spelling the tree uses, and asks for it by name; every public function is named for what it returns." and exits 0.The guard's tests, red against the base tree and green on the branch:
The second half, a decibel value under another head noun or a change of no named level, proved by a guard that reads every difference and change noun as a decibel (a phase difference, a pressure loss, a temperature reduction or adjustment, a threshold shift, a bare drop): the tests that hold it fail there and pass with the real guard.