Skip to content

Commit

Permalink
Large scale change: pre-commit checks vol10 (#1110)
Browse files Browse the repository at this point in the history
Ran pre-commit checks across --all. Changes include
- removing an unused tool verify-trace-members
- spelling cleanups and codespell rule updates
- yapf+pylint clean
- excluding a numer of files not expected to be around much longer

b/278726440
b/199280707
  • Loading branch information
kaidokert authored Aug 4, 2023
1 parent 1292c1d commit 4358730
Show file tree
Hide file tree
Showing 55 changed files with 787 additions and 1,583 deletions.
20 changes: 18 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ exclude: |
base|
build|
buildtools|
cobalt/updater/win|
components/crash/core/common|
components/metrics_services_manager|
components/metrics|
Expand All @@ -20,6 +21,7 @@ exclude: |
components/version_info|
crypto|
extensions/buildflags|
glimp/include|
net|
internal/starboard/shared/playstation/glimp/shaders|
testing|
Expand All @@ -30,6 +32,10 @@ exclude: |
|
components/update_client/((?!cobalt).)*$
|
.*\.pb\.cc$ |
.*\.pb\.h$ |
.*\.patch$ |
.*Proto.java$|
.*\.sig$
)
Expand All @@ -51,16 +57,20 @@ repos:
# The --ignore-words-list argument has a bug where it needs to
# be lowercase, see
# https://github.com/codespell-project/codespell/issues/1390
--ignore-words-list, atleast]
--ignore-words-list, "atleast,varius,ridiculus,statics",
]
exclude: |
(?x)^(
(internal/)?starboard/[^/]+/i18n/|
cobalt/content/licenses/|
cobalt/content/ssl/|
cobalt/fetch/embedded_scripts|
cobalt/streams/embedded_scripts|
cobalt/loader/cors_preflight.cc|
internal/cobalt/browser/splash_screen/youtube_splash_screen.html|
internal/starboard/shared/playstation/storage_internal.cc|
starboard/loader_app/app_key_test.cc|
starboard/shared/starboard/player/testdata|
starboard/shared/win32/media_transform.cc
)
Expand Down Expand Up @@ -123,18 +133,24 @@ repos:
stages: [push]
exclude: |
(?x)^(
.pylintrc$|
.pre-commit-config.yaml$|
cobalt/base/unicode/|
cobalt/demos/content/|
cobalt/layout_tests/testdata/|
cobalt/math/|
cobalt/media/|
cobalt/layout_tests/testdata/|
cobalt/streams/|
cobalt/updater/|
cobalt/webdriver/screencast/|
cobalt/websocket/|
content/|
glimp/|
nb/|
starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java$|
starboard/shared/starboard/player/filter/decoded_audio_queue.cc$|
starboard/shared/starboard/player/filter/decoded_audio_queue.h$|
starboard/shared/starboard/player/testdata/licences/|
starboard/shared/starboard/player/filter/wsola_internal.cc$
)
exclude_types: [markdown]
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ inlinevar-rgx=^[a-z][a-z0-9_]*$
class-rgx=^_?[A-Z][a-zA-Z0-9]*$

# Regular expression matching correct module names
module-rgx=^(_?[a-z][a-z0-9_]*|__init__)$
module-rgx=^(_?[a-z][a-z0-9_]*|__init__|2)$

# Regular expression matching correct method names
method-rgx=(?x)^(?:(?P<exempt>_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P<camel_case>_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$
Expand Down
2 changes: 1 addition & 1 deletion cobalt/base/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace base {

// Event is an abstract, generic class representing some system event that
// occured. Event producers like a SystemWindow will produce these events
// occurred. Event producers like a SystemWindow will produce these events
// and dispatch them to the registered callbacks.
// Derived classes should add the BASE_EVENT_SUBCLASS() macro to their public
// attributes.
Expand Down
2 changes: 1 addition & 1 deletion cobalt/bindings/v8c/templates/macros.cc.template
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
{# If no variadic arguments have been set, we still call the function with
signature that has the variadic argument and pass an empty vector. There is
no such function signature that takes the optional parameter immediately
preceeding the variadic argument but does not take the variadic arguments. #}
preceding the variadic argument but does not take the variadic arguments. #}
{% if loop.last or not operation.arguments[num_arguments].is_variadic %}
{% set function_arguments =
operation.arguments[0:num_arguments]|map(attribute='name')|list %}
Expand Down
5 changes: 3 additions & 2 deletions cobalt/black_box_tests/tests/preload_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ def test_preload_font(self):
start_time = time.time()
while runner.IsInPreload():
if time.time() - start_time > _MAX_RESUME_WAIT_SECONDS:
raise Exception('Cobalt can not exit preload mode after receiving'
'resume signal')
raise RuntimeError(
'Cobalt can not exit preload mode after receiving'
'resume signal')
time.sleep(.1)
# At this point, Cobalt is in started mode.
self.assertTrue(runner.JSTestsSucceeded())
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void BorderShorthandToLonghand::Assign4BordersBasedOnPropertyList(
break;
}
case 2: {
// If left is mising, it is the same as right; If bottom is missing, it is
// If left is missing, it is the same as right; If bottom is missing, it's
// the same as top.
border_top = list->value()[0];
border_right = list->value()[1];
Expand Down
3 changes: 2 additions & 1 deletion cobalt/cssom/css_transition_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <algorithm>
#include <cmath>
#include <utility>

#include "base/lazy_instance.h"
#include "cobalt/base/polymorphic_downcast.h"
Expand Down Expand Up @@ -139,7 +140,7 @@ Transition CreateTransitionOverOldTransition(
scoped_refptr<PropertyValue> current_value_within_old_transition =
old_transition.Evaluate(current_time);

// If the new transition is a reversal fo the old transition, we need to
// If the new transition is a reversal of the old transition, we need to
// setup reversing_adjusted_start_value and reversing_shortening_factor so
// that they can be used to reduce the new transition's duration.
scoped_refptr<PropertyValue> new_reversing_adjusted_start_value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function isComponentCtor<Props>(

/**
* Renders a component to the container element.
* @param CtorOrFunc Can be either a component contructor or a component
* @param CtorOrFunc Can be either a component constructor or a component
* function. The component function is easier to write but does not keep
* track of internal states.
* @param props Component props.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Watch extends Component<Props> {

/**
* Listens to any key event and displays a message. Bootstraps the page once
* user interacts with the docuemnt.
* user interacts with the document.
*/
private waitForInteraction() {
const messageEl = document.createElement('h1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const UNPLAYED_BUFFER_MAX_SIZE = 10; // Only buffer 10 seconds maximum.

/**
* A source buffer wrapper that limits the array buffers that can be added to
* the source buffer. If the bufferred length exceeds the limit, it will
* the source buffer. If the buffered length exceeds the limit, it will
* automatically pauses and waits until the remaining playback time is below the
* limit.
*/
Expand Down
2 changes: 1 addition & 1 deletion cobalt/demos/content/selector-tester/selector-tester.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

<my-div style="position:absolute; left: 50%; width: 40%;">
<div id="title">
<markup>&lt;div id="titile"&gt;</markup>
<markup>&lt;div id="title"&gt;</markup>
Hello, Cobalt!
<markup>&lt;/div&gt;</markup>
</div>
Expand Down
2 changes: 1 addition & 1 deletion cobalt/input/input_device_manager_fuzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace cobalt {
namespace input {

// This input fuzzer will continously generate random input events. It is a
// This input fuzzer will continuously generate random input events. It is a
// debug tool that can be used in place of a platform-specific
// InputDeviceManager that generates input events from an external controller
// device.
Expand Down
2 changes: 1 addition & 1 deletion cobalt/input/key_event_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class KeyEventHandler {
public:
// Called to handle a key event. The base class implementation just calls
// DispatchKeyboardEvent. Overridden versions of this function may modify the
// incoming event and/or generate new events. Overriden versions should call
// incoming event and/or generate new events. Overridden versions should call
// DispatchKeyboardEvent for each event filtered/produced.
virtual void HandleKeyboardEvent(base::Token type,
const dom::KeyboardEventInit& event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
}
image.src = image_url;
}).catch( () => {
console.log('window.screenshot() error occured.');
console.log('window.screenshot() error occurred.');
if (window.testRunner) {
window.testRunner.notifyDone();
}
Expand Down
2 changes: 1 addition & 1 deletion cobalt/layout_tests/testdata/cobalt/screenshot.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
}
image.src = image_url;
}).catch( () => {
console.log('window.screenshot() error occured.');
console.log('window.screenshot() error occurred.');
if (window.testRunner) {
window.testRunner.notifyDone();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!--
| Absolutely positioned elements should have their static position set
| to where they would have appeared if they were layed out within their
| to where they would have appeared if they were laid out within their
| parent element's flow. This test ensures that an absolutely positioned
| element has static position set according to its parent element's flow, not
| its containing block.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!--
| Absolutely positioned elements should have their static position set
| to where they would have appeared if they were layed out within their
| to where they would have appeared if they were laid out within their
| containing block. For absolutely positioned elements, their containing block
| is specified to be their first ancestor that has a position of 'absolute',
| 'relative' or 'fixed'. This test ensures that we locate the containing block
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!--
| When a box is split in inline formatting context, the newly generated box
| inherits the stacking context and the contaning block from the older sibling.
| inherits the stacking context and the containing block from the older sibling.
-->
<html>
<body style="margin:0px; font-family: Roboto; font-size: 20px;">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!--
| This is a simple relative positioning test which checks that the element
| is offset from its standard in-flow position by specifing right and bottom,
| is offset from its standard in-flow position by specifying right and bottom,
| and does not affect the layout of surrounding elements in the flow.
| https://www.w3.org/TR/CSS21/visuren.html#relative-positioning
-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!--
| Absolutely positioned elements should not participate in layout though their
| static position will be set as if they were layed out. This test checks
| static position will be set as if they were laid out. This test checks
| that an absolute element that ordinarily would have caused a line break
| within an inline box does not affect layout, and also that the absolute
| element *does* appear to follow a line break.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
| Absolutely positioned elements should not participate in layout and therefore
| if however their static position should be such that it was as if they did.
| This test ensures that when the element has a display of 'inline', its
| static is where it would have been had it been layed out, even though the
| static is where it would have been had it been laid out, even though the
| layout of its siblings is not affected.
-->
<html>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!--
| One should be able to specify transform functions via scale functions.
| A two time scaled green square is partically overlap with a red square.
| A two time scaled green square is partially overlap with a red square.
-->
<html>
<head>
Expand Down
8 changes: 4 additions & 4 deletions cobalt/math/quad_f.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class QuadF {
return RectF(rl, rt, rr - rl, rb - rt);
}

// Add a vector to the quad, offseting each point in the quad by the vector.
// Add a vector to the quad, offsetting each point in the quad by the vector.
void operator+=(const Vector2dF& rhs);
// Subtract a vector from the quad, offseting each point in the quad by the
// Subtract a vector from the quad, offsetting each point in the quad by the
// inverse of the vector.
void operator-=(const Vector2dF& rhs);

Expand Down Expand Up @@ -112,9 +112,9 @@ inline bool operator!=(const QuadF& lhs, const QuadF& rhs) {
return !(lhs == rhs);
}

// Add a vector to a quad, offseting each point in the quad by the vector.
// Add a vector to a quad, offsetting each point in the quad by the vector.
QuadF operator+(const QuadF& lhs, const Vector2dF& rhs);
// Subtract a vector from a quad, offseting each point in the quad by the
// Subtract a vector from a quad, offsetting each point in the quad by the
// inverse of the vector.
QuadF operator-(const QuadF& lhs, const Vector2dF& rhs);

Expand Down
7 changes: 5 additions & 2 deletions cobalt/render_tree/image_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#ifndef COBALT_RENDER_TREE_IMAGE_NODE_H_
#define COBALT_RENDER_TREE_IMAGE_NODE_H_

#include <utility>

#include "base/compiler_specific.h"
#include "cobalt/base/type_id.h"
#include "cobalt/math/matrix3_f.h"
Expand Down Expand Up @@ -53,7 +55,7 @@ class ImageNode : public Node {
local_transform == other.local_transform;
}

// A source of pixels. May be smaller or larger than layed out image.
// A source of pixels. May be smaller or larger than laid out image.
// The class does not own the image, it merely refers it from a resource
// pool.
scoped_refptr<Image> source;
Expand All @@ -72,7 +74,8 @@ class ImageNode : public Node {

// Forwarding constructor to the set of Builder constructors.
template <typename... Args>
ImageNode(Args&&... args) : data_(std::forward<Args>(args)...) {}
ImageNode(Args&&... args) // NOLINT(runtime/explicit)
: data_(std::forward<Args>(args)...) {}

void Accept(NodeVisitor* visitor) override;
math::RectF GetBounds() const override;
Expand Down
2 changes: 1 addition & 1 deletion cobalt/renderer/rasterizer/stress_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ TEST_F(StressTest, VeryLargeFramebuffer) {
}

namespace {
// Creates a composition of |cascade_amount| render trees layed out in a
// Creates a composition of |cascade_amount| render trees laid out in a
// cascade on top of each other.
scoped_refptr<Node> CreateCascadedRenderTrees(Node* node, int cascade_amount,
float offset_amount) {
Expand Down
4 changes: 2 additions & 2 deletions cobalt/streams/readable_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,8 @@
let method;
try {
method = O[P];
} catch (methodE) {
return Promise_reject(methodE);
} catch (methodError) {
return Promise_reject(methodError);
}

if (method === undefined) {
Expand Down
36 changes: 0 additions & 36 deletions cobalt/tools/verify-trace-members/README.md

This file was deleted.

Loading

0 comments on commit 4358730

Please sign in to comment.