DEV: Remove accidentally committed `puts` statements

DEV: Remove accidentally committed puts statements

diff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rb
index 5072213..3aebe91 100644
--- a/spec/jobs/pull_hotlinked_images_spec.rb
+++ b/spec/jobs/pull_hotlinked_images_spec.rb
@@ -379,13 +379,11 @@ describe Jobs::PullHotlinkedImages do
 
     it "returns false for plugin assets" do
       src = UrlHelper.cook_url("/plugins/discourse-amazing-plugin/myasset.png")
-      puts "src is #{src}"
       expect(subject.should_download_image?(src)).to eq(false)
     end
 
     it "returns false for local non-uploaded files" do
       src = UrlHelper.cook_url("/mycustomroute.png")
-      puts "src is #{src}"
       expect(subject.should_download_image?(src)).to eq(false)
     end
 

GitHub sha: c5078e5d

2 Likes

I wonder if we can add a rubocop rule for the specs? Any ideas @CvX?

2 Likes

I am fine with that as long as maybe we allow deliberate puts

Maybe we allow STDOUT.puts ?

Also we use this on many projects and gems, maybe this is specific to discourse and discourse plugins , maybe we allow this in the specs folder

2 Likes

I don’t see puts being currently used in any of specs in core so linting against it makes sense. If there’s ever any valid case to use it there’s always # rubocop:disable RuleName. :slightly_smiling_face:

Adding to my todo list heap. :wink:

1 Like

Depending on your lint setup (eg. is it running on save?) and if you’re a puts debugger, that might get very annoying.

Writing STDOUT.puts is definitely less work than add that comment :wink:

How often does this happen? If it’s just me being stupid once I’m not sure it’s worth any extra work?

2 Likes

Is that an issue with eslint? I have recently enabled “Format on save”, and have eslint integration enabled, and it works out fine. I get a squiggly line under console.logs and don’t see any downsides.

Right I don’t know if people are running rubocop on save…

I have personally made that mistake at least 2 and I remember both Robin and Sam doing it as well.

It sure is not a big deal in any ways, and was just wondering if it was just a tiny rule we could add to Rubocop.

1 Like

I am running it on save, ale on vim is excellent, it does the linting in a background job

1 Like