diff --git a/.erb_lint.yml b/.erb_lint.yml new file mode 100644 index 0000000..816949c --- /dev/null +++ b/.erb_lint.yml @@ -0,0 +1,35 @@ +--- +glob: "**/*.html{+*,}.erb" +exclude: + - "**/vendor/**/*" +linters: + AllowedScriptType: + enabled: true + ClosingErbTagIndent: + enabled: true + CommentSyntax: + enabled: true + ErbSafety: + enabled: true + ExtraNewline: + enabled: true + FinalNewline: + enabled: true + NoJavascriptTagHelper: + enabled: true + ParserErrors: + enabled: true + RequireInputAutocomplete: + enabled: false + RightTrim: + enabled: true + SelfClosingTag: + enabled: true + SpaceAroundErbTag: + enabled: true + SpaceInHtmlTag: + enabled: true + SpaceIndentation: + enabled: true + TrailingWhitespace: + enabled: true \ No newline at end of file diff --git a/Gemfile b/Gemfile index 4cb2d11..36e7e1d 100644 --- a/Gemfile +++ b/Gemfile @@ -115,6 +115,9 @@ group :development, :test do # Static analysis for security vulnerabilities [https://brakemanscanner.org/] gem "brakeman", require: false + # ERB linting [https://github.com/Shopify/erb_lint] + gem "erb_lint", require: false + # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/] gem "rubocop-rails-omakase", require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 587085a..5b48f05 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,6 +105,13 @@ GEM autotuner (1.1.0) base64 (0.3.0) bcrypt_pbkdf (1.1.1) + better_html (2.2.0) + actionview (>= 7.0) + activesupport (>= 7.0) + ast (~> 2.0) + erubi (~> 1.4) + parser (>= 2.4) + smart_properties bigdecimal (3.3.1) bindex (0.8.1) bootsnap (1.19.0) @@ -154,6 +161,13 @@ GEM drb (2.2.3) ed25519 (1.4.0) erb (6.0.0) + erb_lint (0.9.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop (>= 1) + smart_properties erubi (1.13.1) et-orbi (1.4.0) tzinfo @@ -487,6 +501,7 @@ GEM gli hashie logger + smart_properties (1.17.0) solid_cable (3.0.12) actioncable (>= 7.2) activejob (>= 7.2) @@ -587,6 +602,7 @@ DEPENDENCIES debug doorkeeper (~> 5.8) dotenv-rails + erb_lint flamegraph flipper flipper-active_record diff --git a/app/views/docs/index.html.erb b/app/views/docs/index.html.erb index 00210a6..087ab5a 100644 --- a/app/views/docs/index.html.erb +++ b/app/views/docs/index.html.erb @@ -164,7 +164,8 @@ ['Unity', 'unity'], ['Unreal Engine 4', 'unreal-engine-4'], ['Vim', 'vim'], ['Visual Studio', 'visual-studio'], ['VS Code', 'vs-code'], ['WebStorm', 'webstorm'], ['Windsurf', 'windsurf'], ['Wing', 'wing'], ['Word', 'word'], ['Xcode', 'xcode'], ['Zed', 'zed'], ['Swift Playgrounds', 'swift-playgrounds'] - ].sort_by { |editor| editor[0] } %> + ].sort_by { |editor| editor[0] } + %> <% all_editors.each do |name, slug| %> " class="bg-darkless rounded p-2 hover:bg-primary/10 transition-colors text-center block"> <%= name %> diff --git a/app/views/docs/show.html.erb b/app/views/docs/show.html.erb index 5647d5a..f03065b 100644 --- a/app/views/docs/show.html.erb +++ b/app/views/docs/show.html.erb @@ -44,7 +44,7 @@ } .prose a:hover { color: var(--color-red) !important; - + } <% end %> diff --git a/app/views/leaderboards/index.html.erb b/app/views/leaderboards/index.html.erb index 7b1808e..050727a 100644 --- a/app/views/leaderboards/index.html.erb +++ b/app/views/leaderboards/index.html.erb @@ -2,7 +2,6 @@

Leaderboard

-
<%= link_to "Last 24 Hours", leaderboards_path(period_type: 'daily'), class: "px-4 py-2 rounded-full text-sm font-medium transition-all duration-200 #{@period_type == :daily ? 'bg-primary text-white' : 'text-muted bg-darkless hover:text-white'}", style: "background:none; border:none;" %> diff --git a/app/views/my/mailing_addresses/show.html.erb b/app/views/my/mailing_addresses/show.html.erb index d95c925..6091428 100644 --- a/app/views/my/mailing_addresses/show.html.erb +++ b/app/views/my/mailing_addresses/show.html.erb @@ -38,7 +38,7 @@ <% else %>
- +
Emergency Light

No Address Added!

diff --git a/app/views/my/mailroom/index.html.erb b/app/views/my/mailroom/index.html.erb index 6a77be2..cb56e36 100644 --- a/app/views/my/mailroom/index.html.erb +++ b/app/views/my/mailroom/index.html.erb @@ -28,7 +28,7 @@
<% else %>
- +
Emergency Light

No Address Added!

diff --git a/app/views/public_activity/physical_mail/_first_streak_achieved.html.erb b/app/views/public_activity/physical_mail/_first_streak_achieved.html.erb index 159d8eb..2ff86c2 100644 --- a/app/views/public_activity/physical_mail/_first_streak_achieved.html.erb +++ b/app/views/public_activity/physical_mail/_first_streak_achieved.html.erb @@ -1,2 +1,2 @@ <%= render "shared/user_mention", user: activity.owner %> -just hit their first 7 day coding streak! \ No newline at end of file +just hit their first 7 day coding streak! diff --git a/app/views/public_activity/physical_mail/_mail_sent.html.erb b/app/views/public_activity/physical_mail/_mail_sent.html.erb index f32c975..b34fd61 100644 --- a/app/views/public_activity/physical_mail/_mail_sent.html.erb +++ b/app/views/public_activity/physical_mail/_mail_sent.html.erb @@ -1,2 +1,2 @@ <%= render "shared/user_mention", user: activity.owner %> -was just sent a letter for '<%= activity.parameters[:humanized_mission_type] %>' \ No newline at end of file +was just sent a letter for '<%= activity.parameters[:humanized_mission_type] %>' diff --git a/app/views/public_activity/user/_coding_session.html.erb b/app/views/public_activity/user/_coding_session.html.erb index afdc585..278ea5c 100644 --- a/app/views/public_activity/user/_coding_session.html.erb +++ b/app/views/public_activity/user/_coding_session.html.erb @@ -1,3 +1,3 @@ <%= render "shared/user_mention", user: activity.owner %> just finished coding on <%= activity.parameters['project'] %> -for <%= short_time_simple(activity.parameters['duration_seconds']) %> \ No newline at end of file +for <%= short_time_simple(activity.parameters['duration_seconds']) %> diff --git a/app/views/public_activity/user/_first_signup.html.erb b/app/views/public_activity/user/_first_signup.html.erb index 6d3a89d..22038b0 100644 --- a/app/views/public_activity/user/_first_signup.html.erb +++ b/app/views/public_activity/user/_first_signup.html.erb @@ -1,2 +1,2 @@ <%= render "shared/user_mention", user: activity.owner %> -just signed in for the first time \ No newline at end of file +just signed in for the first time diff --git a/app/views/shared/_modal.html.erb b/app/views/shared/_modal.html.erb index ef664d4..1e9bdf2 100644 --- a/app/views/shared/_modal.html.erb +++ b/app/views/shared/_modal.html.erb @@ -25,7 +25,7 @@ <% end %>

<%= title %>

- + <% if description %>

<%= description %>

<% end %> diff --git a/app/views/static_pages/_filterable_dashboard.html.erb b/app/views/static_pages/_filterable_dashboard.html.erb index 54608fe..4357f46 100644 --- a/app/views/static_pages/_filterable_dashboard.html.erb +++ b/app/views/static_pages/_filterable_dashboard.html.erb @@ -352,4 +352,4 @@ window.hackatimeCharts.initializeCharts(); } -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/static_pages/index.html.erb b/app/views/static_pages/index.html.erb index 92f0ac3..c004de5 100644 --- a/app/views/static_pages/index.html.erb +++ b/app/views/static_pages/index.html.erb @@ -25,7 +25,7 @@

Track How Much You Code

<%= link_to slack_auth_path, class: "inline-flex items-center justify-center px-6 py-3 rounded text-white font-bold cursor-pointer border-none w-full my-2 bg-primary" do %> - + <% end %> @@ -39,7 +39,7 @@
<%= email_field_tag :email, nil, placeholder: "Enter your email to get a sign in link", required: true, class: "w-full px-3 py-3 pr-12 border border-gray-600 rounded text-base bg-gray-800 text-white" %>
<% end %> @@ -109,7 +109,7 @@

Don't commit fraud lol ;)

- + <%= link_to "Start building", "https://summer.hackclub.com/", class: "inline-block bg-[#592F31] font-primary font-bold text-[#f6dbba] px-4 py-2 rounded-[100px] text-[22px] hover:scale-105 transition-transform duration-200", target: "_blank" %>
@@ -125,10 +125,10 @@
- +
- +

Earn an industry recognized technical certificate for coding 30 hours and building 3 personal projects. Win prizes as you code, and a chance to travel to NYC for 2025's largest high school hackathon for girls.

<%= link_to "Join Athena", "https://athena.hackclub.com/", class: "inline-block bg-white font-primary font-bold text-[#D35648] px-4 py-2 m-4 rounded-[100px] text-[22px] hover:scale-105 transition-transform duration-200", target: "_blank" %>
diff --git a/app/views/static_pages/what_is_hackatime.html.erb b/app/views/static_pages/what_is_hackatime.html.erb index 27508e5..b9749ae 100644 --- a/app/views/static_pages/what_is_hackatime.html.erb +++ b/app/views/static_pages/what_is_hackatime.html.erb @@ -37,26 +37,26 @@

What is Hackatime?

- +

Hackatime is a free, open-source coding time tracker built by Hack Club for high school students and developers who want to understand their programming habits.

- +

Unlike other time tracking tools, Hackatime is completely free and designed specifically for the Hack Club community. It helps you see exactly how much time you spend coding, which programming languages you use most, and which editors you prefer.

- +

How Hackatime Works

Hackatime tracks your coding activity automatically by monitoring when you're actively typing in your code editor. It works with over 75 different editors including VS Code, JetBrains IDEs, vim, emacs, and many more.

- +

Why Hackatime Exists

Hackatime was created because Hack Club believes that the more time you spend making things, the better you get at building cool projects. By tracking your coding time, you can see your progress and stay motivated to keep building.

- +

Key Features of Hackatime

  • Completely free - No paid plans or hidden costs
  • @@ -66,20 +66,20 @@
  • Community leaderboards - Compare with other Hack Clubbers
  • Privacy-focused - Minimal data is collected for time tracking. File contents are never sent to our servers or stored.
- +

Getting Started with Hackatime

To start using Hackatime, simply sign in with your Hack Club Slack account or email. Once you're logged in, install the editor plugin for your preferred code editor and start coding. Hackatime will automatically begin tracking your time.

- +
<%= link_to "Get Started with Hackatime", root_path, class: "inline-block bg-primary text-white font-bold px-8 py-3 rounded-lg hover:bg-red-600 transition-colors duration-200" %>
- +

- Hackatime is built and maintained by the Hack Club community. + Hackatime is built and maintained by the Hack Club community. <%= link_to "Learn more about Hack Club", "https://hackclub.com", target: "_blank", class: "text-primary hover:text-red underline" %>.

diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 8ae8a03..400ba71 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -426,7 +426,7 @@
Total Coding Time
-
+
<%= @user.heartbeats.where("time >= ?", 7.days.ago.to_f).count %>
Heartbeats in the Last 7 Days
@@ -459,7 +459,7 @@ <%= link_to "#", class: "w-full bg-gray-700 hover:bg-gray-600 text-white px-4 py-2 rounded font-medium transition-colors inline-flex items-center justify-center gap-2", - data: { + data: { controller: "heartbeat-export", action: "click->heartbeat-export#handleExport" } do %> @@ -491,14 +491,14 @@ <%= form_with url: import_my_heartbeats_path, method: :post, multipart: true, local: true, class: "space-y-4" do |form| %>
- <%= form.file_field :heartbeat_file, + <%= form.file_field :heartbeat_file, accept: ".json,application/json", class: "w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded text-white file:mr-4 file:py-2 file:px-4 file:rounded file:border-0 file:text-sm file:font-semibold file:bg-primary file:text-white hover:file:bg-red transition-colors", required: true %>
- <%= form.submit "Import Heartbeats", + <%= form.submit "Import Heartbeats", class: "bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded font-medium transition-colors inline-flex items-center gap-2", data: { confirm: "Are you sure you want to import heartbeats? This will add new data to your account." } %>
diff --git a/app/views/users/wakatime_setup_step_3.html.erb b/app/views/users/wakatime_setup_step_3.html.erb index 94ef0f7..4e44acf 100644 --- a/app/views/users/wakatime_setup_step_3.html.erb +++ b/app/views/users/wakatime_setup_step_3.html.erb @@ -142,7 +142,7 @@ git clone https://github.com/wakatime/vim-wakatime.git Hackatime works with any editor that supports WakaTime! This includes PyCharm, IntelliJ, Sublime Text, Atom, Neovim, Unity, Godot, and
77+ more editors.

- +

Popular Editors:

diff --git a/bin/lint b/bin/lint index 7514925..6485068 100755 --- a/bin/lint +++ b/bin/lint @@ -2,4 +2,7 @@ set -e echo "rubocoppin'..." -bundle exec rubocop -A \ No newline at end of file +bundle exec rubocop -A + +echo "erb_lintin'..." +bundle exec erb_lint . -a