Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit hook for including the MPLv2 in all source code files #10617

Merged
merged 3 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
10614: Update MPLv2 comments on all templates to match standard forma…
…t produced by pre-commit hook

* Updates existing MPLv2 text to use a https URL
* Amend a handful of Fluent templates that used a token instead of the string "Mozilla" - this standardised things; translation was not used or needed
* Add missing MPLv2 where needed
* Update three tests that regressed with these changes, above
  • Loading branch information
stevejalim committed Oct 22, 2021
commit a67bbd25ea4865da88e48aca0ab882f170227af1
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

Copy link
Collaborator Author

@stevejalim stevejalim Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the webpack config already had the MPL in it (see the final file in this changeset), I'm assuming that literally everything in the repo needs the MPL, including configuration files like this. Makes sense that it would, I think.

module.exports = {
env: {
browser: true,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ Exhibit A - Source Code Form License Notice

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
file, You can obtain one at https://mozilla.org/MPL/2.0/.

If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
Expand Down
3 changes: 3 additions & 0 deletions bedrock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
3 changes: 3 additions & 0 deletions bedrock/base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4 changes: 4 additions & 0 deletions bedrock/base/cache.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

from django.core.cache.backends.locmem import DEFAULT_TIMEOUT, LocMemCache


Expand Down
4 changes: 4 additions & 0 deletions bedrock/base/config_manager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

from everett.manager import ConfigEnvFileEnv, ConfigManager, ConfigOSEnv

config = ConfigManager(
Expand Down
4 changes: 4 additions & 0 deletions bedrock/base/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

from django.conf import settings

from bedrock.base.geo import get_country_from_request
Expand Down
2 changes: 1 addition & 1 deletion bedrock/base/geo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

from django.conf import settings

Expand Down
4 changes: 4 additions & 0 deletions bedrock/base/log_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

import logging
import logging.handlers
import socket
Expand Down
3 changes: 3 additions & 0 deletions bedrock/base/management/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
3 changes: 3 additions & 0 deletions bedrock/base/management/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4 changes: 4 additions & 0 deletions bedrock/base/management/commands/update_www_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

import os

from django.conf import settings
Expand Down
4 changes: 4 additions & 0 deletions bedrock/base/middleware.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

"""
Taken from zamboni.amo.middleware.

Expand Down
4 changes: 4 additions & 0 deletions bedrock/base/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

from django.db import migrations, models


Expand Down
3 changes: 3 additions & 0 deletions bedrock/base/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4 changes: 4 additions & 0 deletions bedrock/base/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

from django.db import models


Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/404.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might look like an uncessary change, but we needed to make sure the existing comments matche the format that the pre-commit hook was expecting and generating, else we'd end up with the MPL double-included


{% extends "base-error.html" %}

Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/500.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% extends "base-error.html" %}

Expand Down
6 changes: 6 additions & 0 deletions bedrock/base/templates/base-article.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% from "macros-protocol.html" import sidemenu_lists with context %}

{% extends 'base-protocol-mozilla.html' %}
Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/base-error.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% extends 'base-protocol-mozilla.html' %}

Expand Down
6 changes: 6 additions & 0 deletions bedrock/base/templates/base-protocol-mozilla.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% extends 'base-protocol.html' %}

{% block body_class %}mzp-t-mozilla{% endblock %}
Expand Down
6 changes: 6 additions & 0 deletions bedrock/base/templates/base-protocol.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set_lang_files "main" %}
<!doctype html>
{# Note the "windows" class, without javascript platform-specific assets default to windows #}
Expand Down
6 changes: 6 additions & 0 deletions bedrock/base/templates/cron-health-check.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

<!doctype html>
<html lang="en">
<head>
Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/includes/banners/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

<aside class="c-banner hide-from-legacy-ie {% block banner_class %}{% endblock %}" id="{% block banner_id %}{% endblock %}">
{# Exclude banners from search result snippets using `data-nosnippet` (issue 8739) #}
Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/includes/banners/fundraiser.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% extends 'includes/banners/base.html' %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set android_url = firefox_adjust_url('android', 'app-store-banner') %}
{% set ios_url = firefox_adjust_url('ios', 'app-store-banner') %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set android_url = focus_adjust_url('android', 'app-store-banner') %}
{% set ios_url = focus_adjust_url('ios', 'app-store-banner') %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

<aside class="c-banner hide-from-legacy-ie mzp-t-dark" id="mobile-compare-banner">
{# Exclude banners from search result snippets using `data-nosnippet` (issue 8739) #}
Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/includes/banners/mr1/eu-banner.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% from "macros.html" import google_play_button with context %}

Expand Down
6 changes: 6 additions & 0 deletions bedrock/base/templates/includes/canonical-url.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

<link rel="canonical" href="{{ settings.CANONICAL_URL + '/' + LANG + canonical_path }}">
<link rel="alternate" hreflang="x-default" href="{{ settings.CANONICAL_URL }}{{ canonical_path }}">
{% if translations -%}
Expand Down
6 changes: 6 additions & 0 deletions bedrock/base/templates/includes/careers-teaser.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shoudn't mess with the beast, I think

_.-~-.
7'' Q..\
_7 (_
Expand Down
6 changes: 6 additions & 0 deletions bedrock/base/templates/includes/google-analytics.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

<!--
Read more about our custom configuration and use of Google Analytics here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1122305#c8
Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/includes/protocol/footer/footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set utm_params = 'utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=footer' %}

Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/includes/protocol/lang-switcher.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% if translations|length > 1 %}
<form id="lang_form" class="mzp-c-language-switcher" method="get" action="#">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set utm_params = 'utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=nav&utm_content=firefox' %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set utm_params = 'utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=nav&utm_content=innovation' %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set utm_params = 'utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=nav&utm_content=products' %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set utm_params = 'utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=nav&utm_content=who-we-are' %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% if not hide_nav_cta %}
<div class="c-navigation-shoulder">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{# Bug 1438302 Avoid duplicate content for en-CA and en-GB pages. #}
{% if LANG == 'en-CA' %}
Expand Down
8 changes: 5 additions & 3 deletions bedrock/base/templates/includes/sticky-promo.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#}
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% set promo_referrals = '?utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=sticky-promo' %}
{% if ftl_has_messages('firefox-sticky-promo-get-the-latest-firefox', 'firefox-sticky-promo-meet-our-family-of') %}
Expand Down
Loading