heldentodd / xray-diffraction

This repository contains the code for one simulation, but eventually three are planned: bragg-law, Single Crystal Diffraction, and Powder Diffraction.
GNU General Public License v3.0
1 stars 1 forks source link

some lines exceed 120 columns #11

Closed pixelzoom closed 4 years ago

pixelzoom commented 4 years ago

Related to #1 (code review):

  • [ ] Generally, lines should not exceed 120 columns. Break up long statements, expressions, or comments into multiple lines to optimize readability. It is OK for require statements or other structured patterns to exceed 120 columns. Use your judgment!

This is all about making it easy for other developers to read your code, especially important when working in a group. If you have to start doing a lot of horizontal scrolling in an editor, it slows us down.

Lines like this in XrayDiffractionModel.js are not a big deal, and I wouldn't bother changing them. All of the important stuff appears before column 120, and I can guess the rest:

       this.pLDWavelengthsProperty = new DerivedProperty( [this.pLDProperty, this.sourceWavelengthProperty], computepLDWavelengths );
                                                                                                                        ^

Lines like this one in XrayParameterPanel.js are significantly longer than 120 columns, and import stuff appears after column 120:

          _2dSinLambdaText.text = '2d sin(θ)/λ = ' + Utils.toFixed( 2 * model.lattice.latticeConstantsP.value.z * Math.sin(model.sourceAngleProperty.value) / model.sourceWavelengthProperty.value, 2 );
                                                                                                                        ^

Since you're the only one working on your code as this point, feel free to do nothing. You may have a nice wide monitor, and the 120-column guideline may be a non-issue for you.

heldentodd commented 4 years ago

I have shortened some lines. I will continue shortening long lines as I see them.