Skip to content

Commit c98ce74

Browse files
authored
Cleanup code (#1053)
This patch removes obsolete comments and standardizes header and inline comment placements. The changes primarily involve reordering or removing ESLint disable comments, license header additions or removals, and the deletion of commented out legacy code. Meanwhile, this patch re-enables `test-raw-pub-sub.js` on Linux platform. Fix: #1052
1 parent 9dc1609 commit c98ce74

31 files changed

+80
-122
lines changed

lib/lifecycle_publisher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class LifecyclePublisher extends Publisher {
3737
* Publish a message only when activated; otherwise do nothing (nop);
3838
*
3939
* @param {object|Buffer} message - The message to be sent, could be kind of JavaScript message generated from .msg
40-
* or be a Buffer for a raw message.
40+
* or be a Buffer for a raw message.
4141
* @returns {undefined}
4242
*/
4343
publish(message) {

lib/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ class Node extends rclnodejs.ShadowNode {
14961496
);
14971497
}
14981498

1499-
// publish ParameterEvent
1499+
// Publish ParameterEvent.
15001500
this._parameterEventPublisher.publish(parameterEvent);
15011501

15021502
return {

lib/parameter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable camelcase */
2-
31
// Copyright (c) 2020 Wayne Parrott. All rights reserved.
42
//
53
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,8 +19,9 @@
2119

2220
'use strict';
2321

22+
/* eslint-disable camelcase */
23+
2424
const IsClose = require('is-close');
25-
const rclnodejs = require('bindings')('rclnodejs');
2625

2726
/**
2827
* The plus/minus tolerance for determining number equivalence.

lib/parameter_service.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const { Parameter, PARAMETER_SEPARATOR } = require('./parameter.js');
2727
* rcl_interfaces/srv/GetParameters
2828
* rcl_interfaces/srv/SetParameters
2929
* rcl_interfaces/srv/SetParametersAtomically
30+
* rcl_interfaces/srv/GetParameterTypes
3031
*
3132
* Call start() to begin receiving client request.
3233
* All service requests are forwarded to the node this service works for.

lib/publisher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Publisher extends Entity {
3838
/**
3939
* Publish a message
4040
* @param {object|Buffer} message - The message to be sent, could be kind of JavaScript message generated from .msg
41-
* or be a Buffer for a raw message.
41+
* or be a Buffer for a raw message.
4242
* @return {undefined}
4343
*/
4444
publish(message) {

lib/rate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//
21
// Licensed under the Apache License, Version 2.0 (the "License");
32
// you may not use this file except in compliance with the License.
43
// You may obtain a copy of the License at

lib/rmw.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
113
'use strict';
214

315
const DistroUtils = require('./distro');

rosidl_gen/filter.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
13+
'use strict';
14+
115
const fs = require('fs');
216
const path = require('path');
317
const os = require('os');

rosidl_gen/message_translator.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
/* eslint-disable max-depth */
1818

19-
const debug = require('debug')('rclnodejs:message_translator');
20-
2119
function isTypedArray(value) {
2220
return ArrayBuffer.isView(value) && !(value instanceof DataView);
2321
}
@@ -39,7 +37,6 @@ function copyMsgObject(msg, obj) {
3937
// It's an array
4038
if (typeof obj[i][0] === 'object') {
4139
// It's an array of objects: converting to ROS message objects
42-
4340
// 1. Extract the element-type first
4441
// 2. Build the array by translate every elements
4542
let msgArray = [];
@@ -66,8 +63,7 @@ function copyMsgObject(msg, obj) {
6663
function verifyMessage(message, obj) {
6764
if (message.constructor.isROSArray) {
6865
// It's a ROS message array
69-
// Note: there won't be any JavaScript array in message
70-
66+
// Note: there won't be any JavaScript array in message.
7167
if (!Array.isArray(obj)) {
7268
return false;
7369
}
@@ -131,7 +127,7 @@ function toPlainObject(message, enableTypedArray = true) {
131127

132128
if (message.constructor.isROSArray) {
133129
// It's a ROS message array
134-
// Note: there won't be any JavaScript array in message
130+
// Note: there won't be any JavaScript array in message.
135131
let array = [];
136132
message.data.forEach((e) => {
137133
array.push(toPlainObject(e, enableTypedArray)); // Translate every elements

rostsd_gen/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable max-depth */
2-
/* eslint-disable no-sync */
3-
/* eslint-disable camelcase */
41
// Licensed under the Apache License, Version 2.0 (the "License");
52
// you may not use this file except in compliance with the License.
63
// You may obtain a copy of the License at
@@ -26,6 +23,10 @@ declare module "rclnodejs" {
2623
}
2724
*/
2825

26+
/* eslint-disable max-depth */
27+
/* eslint-disable no-sync */
28+
/* eslint-disable camelcase */
29+
2930
'use strict';
3031

3132
const path = require('path');

0 commit comments

Comments
 (0)