python-novice-inflammation icon indicating copy to clipboard operation
python-novice-inflammation copied to clipboard

Long lines in lessons

Open maxim-belkin opened this issue 6 years ago • 21 comments

We need to shorten the following long lines in lessons (based on make lesson-check-all). Please feel free to submit PRs (please change one file per PR) and reference this issue (use #498).

$ make lesson-check-all ~~/CONTRIBUTING.md: Line(s) too long: 3, 114, 126~~ (Out of scope: has to be fixed in carpentries/style)

  • [ ] ./README.md: Line(s) too long: 2, 4, 5, 7, 8, 9, 10, 13, 30
  • [x] ./_episodes/01-intro.md: Line(s) too long: 160, 175
  • [x] ./_episodes/02-numpy.md: Line(s) too long: 69, 71, 80, 91, 95, 96, 98, 99, 100, 101, 102, 278, 441, 578
  • [x] ./_episodes/03-matplotlib.md: Line(s) too long: 33, 44
  • [x] ./_episodes/04-loop.md: Line(s) too long: 373
  • [x] ./_episodes/05-lists.md: Line(s) too long: 23, 120, 273, 291
  • [x] ./_episodes/07-cond.md: Line(s) too long: 103
  • [x] ./_episodes/09-errors.md: Line(s) too long: 498
  • [x] ./_episodes/11-debugging.md: Line(s) too long: 68
  • [x] ./setup.md: Line(s) too long: 47, 50, 55, 57, 102

Updated: January 20, 2021

maxim-belkin avatar Apr 13 '18 08:04 maxim-belkin

Just for my own learning, why is it important to limit the lines to 100 characters? Is it about readability of the code? Are there other formatting conventions I should keep in mind?

ncgoodbody avatar May 02 '18 20:05 ncgoodbody

Also, please ignore #519. I forgot to delete my old fork before I started work on the new file.

ncgoodbody avatar May 02 '18 20:05 ncgoodbody

Just for my own learning, why is it important to limit the lines to 100 characters?

git tracks changes on a line-by-line basis, so if you change a single character in a 5000 character-long paragraph written as a single line, it will highlight the entire line. Moreover, it will show it twice (original and changed version). And single line breaks are not a problem for Markdown... so, there is really no benefit in using long lines as shorter ones make life much easier.

Why exactly 100? This number is more-or-less arbitrary. People usually choose the number of characters that fit in their text editor without wrapping to the next (virtual) line. "100" is hard-coded into lesson-check and, honestly, I don't care about its exact value as long as it is reasonable: not too small, not too large... it could be 78, 83, 94, etc.

Also, please ignore #519. I forgot to delete my old fork before I started work on the new file.

Um... ok, but we need to talk :) You should use branches for pull requests:

git checkout -f gh-pages
git pull origin gh-pages

git branch mybranch
git checkout mybranch
# make changes
git add -u
git commit
git push <your-fork>

git checkout gh-pages
# submit pull-request on GitHub

maxim-belkin avatar May 02 '18 20:05 maxim-belkin

Thanks for the explanation @maxim-belkin!

Don't I need permission to access this repository in order to make branches? I'm working from the GitHub desktop client, so do I need to work in git directly?

ncgoodbody avatar May 02 '18 22:05 ncgoodbody

Um, to create branches in this repository one has to have proper permissions, but you don't need these. The way it works is as follows:

  1. you fork this repository. Your fork will be here https://github.com/doctornerdis/python-novice-inflammation
  2. You clone your fork to your computer git clone https://github.com/doctornerdis/python-novice-inflammation
  3. You create a new branch for your changes: git checkout -b my-changes
  4. You make changes to files, then git add -u, git commit
  5. You push your branch to your fork git push
  6. You submit a PR on GitHub using this branch

To keep your fork up-to-date, you do:

git checkout gh-pages
git add swcarpentry https://github.com/swcarpentry/python-novice-inflammation  ## only once per repository
git fetch swcarpentry
git merge --ff-only
git push

Oh, and I now see that you've already deleted your fork that you used to submit #520. There is a better way! :)

maxim-belkin avatar May 02 '18 22:05 maxim-belkin

OK, I think I'm getting the hang of it now. I just did another PR (#521). Is that the right workflow?

ncgoodbody avatar May 02 '18 22:05 ncgoodbody

Yep! Just don't forget to switch back to gh-pages before creating a branch for your next PR

git checkout gh-pages
git pull swcarpentry ## just in case
git checkout -b my-next-pr

maxim-belkin avatar May 02 '18 22:05 maxim-belkin

Hi @maxim-belkin , may be worth ticking off the lessons that have been done from the issue description at the top of this page, to make it clearer to newcomers which are left to do

mike-allaway avatar May 23 '18 16:05 mike-allaway

Thank you for the reminder, @MikeAllawayBham!

maxim-belkin avatar May 23 '18 16:05 maxim-belkin

I just opened #565 to help address this ! I did have one question, though -- is the Code of Conduct still in need of definitions ? It seems to be rendering correctly, but I might have misunderstood the concern !

emdupre avatar Jul 17 '18 14:07 emdupre

Thank you for the PR, @emdupre! I've updated the original post with the current list of issues. Regarding Code of Conduct - I think the issue was solved in 51293be...

maxim-belkin avatar Jul 17 '18 15:07 maxim-belkin

Hi, I'd like to help with this. Is there a good way of testing it renders correctly?

katkoler avatar Oct 12 '18 13:10 katkoler

Hi, @katkoler. If you've got macOS or Linux, make serve (or jekyll serve or bundle exec jekyll serve) will render the site for you and you will be able to check it out at http://127.0.0.1:4000. If you're on a Windows machine make docker-serve.

maxim-belkin avatar Oct 12 '18 14:10 maxim-belkin

@maxim-belkin thanks! I'll just check that everything looks okay and open a pull request.

katkoler avatar Oct 12 '18 15:10 katkoler

Is there still any help needed?

SRSteinkamp avatar Jan 19 '21 13:01 SRSteinkamp

Hi Simon, Thank you for inquiring. I have updated the description with the output of running the command $ make lesson-check-all which shows that we have lines that needed shortening. If you would like to work on this issue, please edit one file per PR. Thanks!

ldko avatar Jan 20 '21 18:01 ldko

Thank you Idko for putting me into the loop :)

I will work on the other files in the coming days, that's it for today :) ... also if you have any comments on how to improve my PRs, I am happy to adjust them (especially in the future!)

SRSteinkamp avatar Jan 20 '21 21:01 SRSteinkamp

Hi!

I just ran the make lesson-check-all command and got the following output:

./CONTRIBUTING.md: Line(s) too long: 3, 114, 126
./README.md: Line(s) too long: 2, 4, 5, 7, 8, 9, 10, 13
./_episodes/03-matplotlib.md: Line(s) too long: 133

I will submit PRs to try to fix the remaining warnings.

Best,

V

vinisalazar avatar Mar 22 '21 17:03 vinisalazar

Hi @vinisalazar , thanks for the offer! I believe the changes in CONTRIBUTING.md would need to be done outside of this lesson, specifically in the carpentries/style repo. The README.md lines that are too long are due to the markdown formatting for the table on the page, and I don't know of a way to get them under the 100 character mark and retain the formatting (if you do, please submit a fix :) ). Getting a PR from you for the 03-matlotlib.md file would be great!

ldko avatar Mar 22 '21 17:03 ldko

Hi @ldko ! Thank you for the fast reply.

Good observation. I'll have a look at the template repos to see if I can contribute something there.

Best,

V

vinisalazar avatar Mar 22 '21 17:03 vinisalazar

carpentries/lesson-example#330 addresses the CONTRIBUTING.md and README.md files.

vinisalazar avatar Mar 25 '21 00:03 vinisalazar