Code formatting #264
-
Is there some sort of code formatting standard for gplately? I only ask because a lot of the For example, much of the code in For example, grid_points_inside_merged_continent[continent.grid_points_inside_continent] = True ...got changed to: grid_points_inside_merged_continent[
continent.grid_points_inside_continent
] = True And: self.contouring_buffer_and_gap_distance_radians = contouring_buffer_and_gap_distance_radians ...got changed to: self.contouring_buffer_and_gap_distance_radians = (
contouring_buffer_and_gap_distance_radians
) And: continent_contouring_area_threshold_steradians = self.continent_contouring_area_threshold_steradians_function(age)
if (continent_contouring_area_threshold_steradians > 0 and
contoured_continent.get_area() < continent_contouring_area_threshold_steradians):
continue ...got changed to: continent_contouring_area_threshold_steradians = (
self.continent_contouring_area_threshold_steradians_function(age)
)
if (
continent_contouring_area_threshold_steradians > 0
and contoured_continent.get_area()
< continent_contouring_area_threshold_steradians
):
continue |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I am using the 'black' formatter. |
Beta Was this translation helpful? Give feedback.
-
In reference to your recent comment, do you think it's worth splitting one commit into two in these cases? In other words, one commit is the actual code change and a second commit is the 'black' reformatting. Because I was quickly browsing through your changes the other day (out of curiosity) and it was a little hard to find the real changes. I guess eventually the entire codebase will get 'black' reformatted (especially if we all use it). |
Beta Was this translation helpful? Give feedback.
-
I found the formatting changes afterwards. I was surprised too. And I added the comments in honors of the original owner of that file. I chose "black" randomly. If we have better choices, I am happy to use another one instead. The important thing is the team need to agree on the one formatter and use it. Another option is create a github action and run "code formatting/checking" automatically. |
Beta Was this translation helpful? Give feedback.
Or maybe there can be a one-off 'black' reformat of the entire code base, as a single big commit. After that, we all use the 'black' reformatter when committing. That way future commits will only show the "real" changes.