aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2021-07-06 08:46:18 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2021-07-06 08:46:18 +0200
commit6be4bdf6ad92eea3e57ccfaf95672daf43cc1090 (patch)
tree090a0fc781b2482be03f8bef69d33dc7d9ba7c09
parentba3cfcd0b25c2b4ff47d325db3c592a0673df5f6 (diff)
downloadjo.mssola.com-6be4bdf6ad92eea3e57ccfaf95672daf43cc1090.tar.gz
jo.mssola.com-6be4bdf6ad92eea3e57ccfaf95672daf43cc1090.zip
ci: fixed a lot of issues with style and urls
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
-rw-r--r--.rubocop.yml46
-rw-r--r--Gemfile22
-rw-r--r--Gemfile.lock7
-rw-r--r--Rakefile10
-rw-r--r--_i18n/ca/license.md4
-rw-r--r--_i18n/en/license.md4
-rw-r--r--_includes/footer.html2
-rw-r--r--_plugins/log.rb51
-rw-r--r--_plugins/modified_time_helper.rb2
-rw-r--r--_plugins/twitter.rb22
-rw-r--r--_plugins/type.rb32
-rw-r--r--about/cv.html4
-rw-r--r--about/index.html4
13 files changed, 92 insertions, 118 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index e547be9..3d4067a 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,3 +1,7 @@
+require:
+ - rubocop-performance
+ - rubocop-rake
+
AllCops:
TargetRubyVersion: 3.0
@@ -9,60 +13,20 @@ AllCops:
Exclude:
- './_site/**/*'
-#
-# Layout
-#
-
-# This is a remnant of old SUSE-style alignment for hashes, The table format
-# looks more human readable.
Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
-# The default is just too small. A limit of 100 looks reasonable and many other
-# projects (including inside of SUSE) are also using this value.
-Layout/LineLength:
- Max: 100
-
-#
-# Metrics
-#
-
-# The default is just too small.
Metrics/AbcSize:
Max: 30
Metrics/MethodLength:
Max: 20
-#
-# Style
-#
-
# This forces us to create a new object for no real reason.
Style/MultipleComparison:
Enabled: false
-# This is a common SUSE configuration value: the performance difference between
-# single and double quotes is no longer there, and so it's better to be
-# consistent and force only double quotes.
-Style/StringLiterals:
- EnforcedStyle: double_quotes
-
-# Same as Style/StringLiterals.
-Style/StringLiteralsInInterpolation:
- EnforcedStyle: double_quotes
-
+# It's actually quite cool to spell my own name correctly...
Style/AsciiComments:
Enabled: false
-
-## New stuff
-
-Style/HashEachMethods:
- Enabled: true
-
-Style/HashTransformKeys:
- Enabled: true
-
-Style/HashTransformValues:
- Enabled: true
diff --git a/Gemfile b/Gemfile
index 3419f9e..0dd2704 100644
--- a/Gemfile
+++ b/Gemfile
@@ -15,17 +15,19 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-source "https://rubygems.org"
+source 'https://rubygems.org'
-gem "html-proofer"
-gem "jekyll", "~> 4.2.0"
-gem "jemoji"
-gem "kramdown-parser-gfm"
-gem "rake"
-gem "rubocop"
-gem "sass"
-gem "webrick"
+gem 'html-proofer'
+gem 'jekyll', '~> 4.2.0'
+gem 'jemoji'
+gem 'kramdown-parser-gfm'
+gem 'rake'
+gem 'rubocop'
+gem 'rubocop-performance', require: false
+gem 'rubocop-rake', require: false
+gem 'sass'
+gem 'webrick'
group :jekyll_plugins do
- gem "jekyll-multiple-languages-plugin"
+ gem 'jekyll-multiple-languages-plugin'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 4721434..b0af6f4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -102,6 +102,11 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.7.0)
parser (>= 3.0.1.1)
+ rubocop-performance (1.11.3)
+ rubocop (>= 1.7.0, < 2.0)
+ rubocop-ast (>= 0.4.0)
+ rubocop-rake (0.6.0)
+ rubocop (~> 1.0)
ruby-progressbar (1.11.0)
safe_yaml (1.0.5)
sass (3.7.4)
@@ -133,6 +138,8 @@ DEPENDENCIES
kramdown-parser-gfm
rake
rubocop
+ rubocop-performance
+ rubocop-rake
sass
webrick
diff --git a/Rakefile b/Rakefile
index 3f7e6da..173375c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -15,10 +15,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-abort("Please run this using `bundle exec rake`") unless ENV["BUNDLE_BIN_PATH"]
-require "html-proofer"
+abort('Please run this using `bundle exec rake`') unless ENV['BUNDLE_BIN_PATH']
+require 'html-proofer'
-desc "Test the website"
+desc 'Test the website'
task :test do
options = {
check_sri: true,
@@ -29,11 +29,11 @@ task :test do
timeout: 120
},
cache: {
- timeframe: "6w"
+ timeframe: '6w'
}
}
- dir = ENV["BUILD_DEST"] || "./_site"
+ dir = ENV['BUILD_DEST'] || './_site'
HTMLProofer.check_directory(dir, options).run
end
diff --git a/_i18n/ca/license.md b/_i18n/ca/license.md
index 6cb631f..cf6e04a 100644
--- a/_i18n/ca/license.md
+++ b/_i18n/ca/license.md
@@ -1,9 +1,9 @@
## Sobre això
Aquesta és la meva pàgina personal, on escric coses que tenen més o menys
-sentit. El codi font es pot trobar [aquí](http://git.mssola.com/jo.git/).
+sentit. El codi font es pot trobar [aquí](https://github.com/mssola/jo.mssola.com).
-## Llicència ([AGPLv3](http://git.mssola.com/jo.git/tree/LICENSE))
+## Llicència ([AGPLv3](https://www.gnu.org/licenses/agpl-3.0.html))
<div class="org-src-container">
<pre class="src src-txt">
diff --git a/_i18n/en/license.md b/_i18n/en/license.md
index f2efeda..742d535 100644
--- a/_i18n/en/license.md
+++ b/_i18n/en/license.md
@@ -1,9 +1,9 @@
## About this
This is my personal webpage, where I write stuff. The source code can be found
-[here](http://git.mssola.com/jo.git/).
+[here](https://github.com/mssola/jo.mssola.com).
-## License ([AGPLv3](http://git.mssola.com/jo.git/tree/LICENSE))
+## License ([AGPLv3](https://www.gnu.org/licenses/agpl-3.0.html))
<div class="org-src-container">
<pre class="src src-txt">
diff --git a/_includes/footer.html b/_includes/footer.html
index ad3182e..9423e87 100644
--- a/_includes/footer.html
+++ b/_includes/footer.html
@@ -7,7 +7,7 @@
<br />
{% t footer.this_website %}
<a title="GNU Affero General Public License" href="{% tl license %}">AGPLv3</a>
- (<a href="http://git.mssola.com/jo.git/">{% t footer.source_code %}</a>).
+ (<a href="https://github.com/mssola/jo.mssola.com">{% t footer.source_code %}</a>).
</p>
</div>
</footer>
diff --git a/_plugins/log.rb b/_plugins/log.rb
index 203f583..436b902 100644
--- a/_plugins/log.rb
+++ b/_plugins/log.rb
@@ -15,8 +15,8 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-require "date"
-require_relative "modified_time_helper"
+require 'date'
+require_relative 'modified_time_helper'
module Jekyll
# Render the last modification time of the given page.
@@ -24,10 +24,10 @@ module Jekyll
include ::Jekyll::ModifiedTimeHelper
def render(context)
- time = Time.iso8601(modified_time(context["page"]))
+ time = Time.iso8601(modified_time(context['page']))
- if context["page"]["lang"] == "en"
- time.strftime("%B %-d, %Y, at %H:%m")
+ if context['page']['lang'] == 'en'
+ time.strftime('%B %-d, %Y, at %H:%m')
else
time.strftime("%-d de #{catalan_month(time.month)} de %Y, a les %H:%m")
end
@@ -40,31 +40,31 @@ module Jekyll
def catalan_month(month)
case month
when 1
- "gener"
+ 'gener'
when 2
- "febrer"
+ 'febrer'
when 3
- "març"
+ 'març'
when 4
- "abril"
+ 'abril'
when 5
- "maig"
+ 'maig'
when 6
- "juny"
+ 'juny'
when 7
- "juliol"
+ 'juliol'
when 8
- "agost"
+ 'agost'
when 9
- "setembre"
+ 'setembre'
when 10
- "octubre"
+ 'octubre'
when 11
- "novembre"
+ 'novembre'
when 12
- "desembre"
+ 'desembre'
else
- ""
+ ''
end
end
# rubocop:enable Metrics/MethodLength, Metrics/CyclomaticComplexity
@@ -74,14 +74,15 @@ module Jekyll
class RenderLogLink < Liquid::Tag
include ::Jekyll::ModifiedTimeHelper
- WEBSITE_BASE = "http://git.mssola.com"
- WEBSITE_REPO = "jo.git"
+ WEBSITE_BASE = 'https://github.com'
+ WEBSITE_REPO = 'mssola/jo.mssola.com'
+ WEBSITE_BRANCH = 'main'
def render(context)
- page = context["page"]
- url = "#{WEBSITE_BASE}/#{WEBSITE_REPO}/log/#{page["relative_path"]}"
+ page = context['page']
+ url = "#{WEBSITE_BASE}/#{WEBSITE_REPO}/commits/#{WEBSITE_BRANCH}/#{page['relative_path']}"
- if page["lang"] == "en"
+ if page['lang'] == 'en'
"<a href=\"#{url}\" title=\"Log for this page\">here</a>"
else
"<a href=\"#{url}\" title=\"Historial d'aquesta pàgina (anglès)\">aquí</a>"
@@ -90,5 +91,5 @@ module Jekyll
end
end
-Liquid::Template.register_tag("render_modified_at", Jekyll::RenderModifiedAt)
-Liquid::Template.register_tag("render_log_link", Jekyll::RenderLogLink)
+Liquid::Template.register_tag('render_modified_at', Jekyll::RenderModifiedAt)
+Liquid::Template.register_tag('render_log_link', Jekyll::RenderLogLink)
diff --git a/_plugins/modified_time_helper.rb b/_plugins/modified_time_helper.rb
index af29b89..52a780b 100644
--- a/_plugins/modified_time_helper.rb
+++ b/_plugins/modified_time_helper.rb
@@ -20,7 +20,7 @@ module Jekyll
module ModifiedTimeHelper
# Returns the modified time of the given page.
def modified_time(page)
- path = File.expand_path(File.join(File.dirname(__FILE__), "..", page["path"]))
+ path = File.expand_path(File.join(File.dirname(__FILE__), '..', page['path']))
out = `git log -n 1 --pretty='format:%cd' --date=iso8601-strict -- #{path}`
begin
diff --git a/_plugins/twitter.rb b/_plugins/twitter.rb
index 4f2f3d2..e211374 100644
--- a/_plugins/twitter.rb
+++ b/_plugins/twitter.rb
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-require_relative "render_helper"
+require_relative 'render_helper'
module Jekyll
# Render the OG image meta HTML tag for the currently rendered page.
@@ -23,32 +23,32 @@ module Jekyll
include ::Jekyll::RenderHelper
# The path to be used when the current page does not have a specific image.
- DEFAULT_PATH = "/images/default.png"
+ DEFAULT_PATH = '/images/default.png'
def render(context)
- img = "#{normalize(context["raw_title"])}.png"
+ img = "#{normalize(context['raw_title'])}.png"
path = image_exists?(img) ? "/images/posts/#{img}" : DEFAULT_PATH
- render_meta("og:image", "http://jo.mssola.com#{path}") +
- render_meta("og:image:width", 630) +
- render_meta("og:image:height", 315) +
- render_meta("twitter:image", "http://jo.mssola.com#{path}", name: true)
+ render_meta('og:image', "http://jo.mssola.com#{path}") +
+ render_meta('og:image:width', 630) +
+ render_meta('og:image:height', 315) +
+ render_meta('twitter:image', "http://jo.mssola.com#{path}", name: true)
end
protected
# Returns true if the given image exists inside of /images/posts.
def image_exists?(image)
- return false if image == ".png"
+ return false if image == '.png'
- path = File.expand_path(File.join(File.dirname(__FILE__), "..", "images", "posts", image))
+ path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'images', 'posts', image))
File.file?(path)
end
# Downcases the given string and replaces space characters with "-"
def normalize(str)
- str.gsub(/\s/, "-").downcase
+ str.gsub(/\s/, '-').downcase
end
end
end
-Liquid::Template.register_tag("render_og_image", Jekyll::RenderOGImageTag)
+Liquid::Template.register_tag('render_og_image', Jekyll::RenderOGImageTag)
diff --git a/_plugins/type.rb b/_plugins/type.rb
index 8c4c2b8..f17d2f4 100644
--- a/_plugins/type.rb
+++ b/_plugins/type.rb
@@ -15,9 +15,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-require "time"
-require_relative "render_helper"
-require_relative "modified_time_helper"
+require 'time'
+require_relative 'render_helper'
+require_relative 'modified_time_helper'
module Jekyll
# Render og:type related tags.
@@ -26,8 +26,8 @@ module Jekyll
include ::Jekyll::ModifiedTimeHelper
def render(context)
- if ["posts"].include?(context["page"]["collection"])
- render_article_tags(context["page"])
+ if ['posts'].include?(context['page']['collection'])
+ render_article_tags(context['page'])
else
'<meta property="og:type" content="website" />'
end
@@ -37,18 +37,18 @@ module Jekyll
# Render all the tags related to the article og:type.
def render_article_tags(page)
- tags = page["tags"].inject("") { |acc, t| acc + render_meta("article:tag", t) }
+ tags = page['tags'].inject('') { |acc, t| acc + render_meta('article:tag', t) }
# rubocop:disable Style/StringConcatenation
'<meta property="og:type" content="article" />' +
- render_meta("og:author", "Miquel Sabaté Solà") +
- render_meta("profile:first_name", "Miquel") +
- render_meta("profile:last_name", "Sabaté Solà") +
- render_meta("profile:username", "mssola") +
- render_meta("profile:gender", "male") +
- render_meta("article:section", page["collection"]) +
- render_meta("article:published_time", published_time(page)) +
- render_meta("article:modified_time", modified_time(page)) +
+ render_meta('og:author', 'Miquel Sabaté Solà') +
+ render_meta('profile:first_name', 'Miquel') +
+ render_meta('profile:last_name', 'Sabaté Solà') +
+ render_meta('profile:username', 'mssola') +
+ render_meta('profile:gender', 'male') +
+ render_meta('article:section', page['collection']) +
+ render_meta('article:published_time', published_time(page)) +
+ render_meta('article:modified_time', modified_time(page)) +
tags
# rubocop:enable Style/StringConcatenation
end
@@ -57,9 +57,9 @@ module Jekyll
def published_time(page)
# We could do fancy stuff like using DateTime.strptime and so on, but
# Jekyll completely disregards the hour, minutes, etc., so why bother.
- page["date"].to_s.split.first
+ page['date'].to_s.split.first
end
end
end
-Liquid::Template.register_tag("render_type_tags", Jekyll::RenderTypeTags)
+Liquid::Template.register_tag('render_type_tags', Jekyll::RenderTypeTags)
diff --git a/about/cv.html b/about/cv.html
index e4037a4..b5a7ddf 100644
--- a/about/cv.html
+++ b/about/cv.html
@@ -3,8 +3,8 @@ title: titles.cv
layout: default
namespace: about
-permalink: /about/cv
-permalink_en: /about/cv
+permalink: /about/cv.html
+permalink_en: /about/cv.html
---
<div id="cv">
diff --git a/about/index.html b/about/index.html
index 7498c4f..729f5fb 100644
--- a/about/index.html
+++ b/about/index.html
@@ -3,8 +3,8 @@ title: titles.about
layout: default
namespace: about
-permalink: /about
-permalink_en: /about
+permalink: /about/
+permalink_en: /about/
---
{% tf about.md %}