Add vera rules to check consecutive and trailing empty lines (#3540)

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
Dániel Bátyai 2020-02-03 16:39:04 +01:00 committed by GitHub
parent 563a5d93e9
commit a78c8d4f16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 68 additions and 87 deletions

View File

@ -1758,7 +1758,6 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
} /* jerry_get_literals_from_snapshot */
/**
* Generate snapshot function from specified source and arguments
*

View File

@ -2885,7 +2885,6 @@ jerry_objects_foreach_by_native_info (const jerry_object_native_info_t *native_i
ecma_native_pointer_t *native_pointer_p;
jmem_cpointer_t iter_cp = JERRY_CONTEXT (ecma_gc_objects_cp);
while (iter_cp != JMEM_CP_NULL)

View File

@ -455,7 +455,6 @@
# define JERRY_ATTR_GLOBAL_HEAP
#endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */
/**
* Sanity check for macros to see if the values are 0 or 1
*
@ -653,7 +652,6 @@
# error "Invalid value for 'JERRY_VM_EXEC_STOP' macro."
#endif
#define ENABLED(FEATURE) ((FEATURE) == 1)
#define DISABLED(FEATURE) ((FEATURE) != 1)

View File

@ -1150,7 +1150,6 @@ jerry_debugger_receive (jerry_debugger_uint8_data_t **message_data_p) /**< [out]
}
} /* jerry_debugger_receive */
#undef JERRY_DEBUGGER_CHECK_PACKET_SIZE
/**
@ -1214,7 +1213,6 @@ jerry_debugger_send_type (jerry_debugger_header_type_t type) /**< message type *
jerry_debugger_send (sizeof (jerry_debugger_send_type_t));
} /* jerry_debugger_send_type */
/**
* Send the type signal to the client.
*

View File

@ -676,7 +676,6 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */
cesu8_string2_p,
cesu8_string2_size);
if (magic_string_id != LIT_MAGIC_STRING__COUNT)
{
ecma_deref_ecma_string (string1_p);

View File

@ -79,7 +79,6 @@ ecma_module_create_normalized_path (const uint8_t *char_p, /**< module specifier
ECMA_MODULE_MAX_PATH,
(char *) module_path_p);
if (normalized_size > 0)
{
/* Convert the normalized path to cesu8. */

View File

@ -245,7 +245,6 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
uint32_t mask = hashmap_p->max_property_count - 1;
entry_index &= mask;
#ifndef JERRY_NDEBUG
/* See the comment for this variable in ecma_property_hashmap_create. */
uint32_t start_entry_index = entry_index;

View File

@ -72,7 +72,6 @@ void ecma_property_hashmap_insert (ecma_object_t *object_p, ecma_string_t *name_
ecma_property_hashmap_delete_status ecma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp,
ecma_property_t *property_p);
ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, ecma_string_t *name_p,
jmem_cpointer_t *property_real_name_cp);
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */

View File

@ -19,7 +19,6 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if ENABLED (JERRY_ES2015)
SIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN,

View File

@ -1292,7 +1292,6 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
return get_value;
}
if (ecma_is_value_found (get_value))
{
/* 9.c.ii */
@ -1944,7 +1943,6 @@ ecma_builtin_array_prototype_object_map (ecma_value_t arg1, /**< callbackfn */
mapped_value,
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
ecma_free_value (mapped_value);
ecma_free_value (current_value);
#if ENABLED (JERRY_ES2015)

View File

@ -183,7 +183,6 @@ ecma_date_parse_month_name (const lit_utf8_byte_t **str_p, /**< pointer to the c
return 0;
} /* ecma_date_parse_month_name */
/**
* Calculate MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)) for Date constructor and UTC
*

View File

@ -387,7 +387,6 @@ ecma_builtin_global_object_parse_float (const lit_utf8_byte_t *string_buff, /**<
}
}
/* Set end position to the end of whole part. */
end_p = str_curr_p;
if (str_curr_p < str_end_p)
@ -425,7 +424,6 @@ ecma_builtin_global_object_parse_float (const lit_utf8_byte_t *string_buff, /**<
}
}
if (str_curr_p < str_end_p)
{
current = *str_curr_p++;

View File

@ -146,7 +146,6 @@ OBJECT_VALUE (LIT_MAGIC_STRING_REFLECT_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* ENABLED (JERRY_ES2015_BUILTIN_REFLECT) */
#if ENABLED (JERRY_BUILTIN_JSON)
/* ECMA-262 v5, 15.1.5.2 */
OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U,

View File

@ -72,4 +72,3 @@ ecma_builtin_helper_error_dispatch_call (ecma_standard_error_t error_type, /**<
* @}
* @}
*/

View File

@ -220,7 +220,6 @@ ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, /**< th
ecma_value_t index_obj_value = ecma_op_to_object (index_value);
if (ECMA_IS_VALUE_ERROR (index_obj_value))
{
ecma_free_value (index_value);
@ -265,7 +264,6 @@ cleanup:
return ret_string_p;
} /* ecma_builtin_helper_get_to_locale_string_at_index */
/**
* The Object.keys and Object.getOwnPropertyNames routine's common part.
*

View File

@ -444,7 +444,6 @@ ecma_builtin_math_dispatch_routine (uint16_t builtin_routine_id, /**< built-in w
arguments_number);
}
JERRY_ASSERT (builtin_routine_id == ECMA_MATH_OBJECT_RANDOM);
return ecma_builtin_math_object_random ();

View File

@ -50,7 +50,6 @@ enum
ECMA_OBJECT_PROTOTYPE_PROPERTY_IS_ENUMERABLE,
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-object-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID object_prototype
#include "ecma-builtin-internal-routines-template.inc.h"

View File

@ -180,7 +180,6 @@ ecma_set_prototype_of (ecma_value_t o_value, /**< O */
ECMA_SET_NON_NULL_POINTER (v_cp, ecma_get_object_from_value (v_value));
}
/* 3., 4. */
if (v_cp == o_p->u2.prototype_cp)
{

View File

@ -133,7 +133,6 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for
JERRY_ASSERT (ecma_is_value_object (iterator)
&& ecma_is_value_object (capability));
ecma_object_t *capability_obj_p = ecma_get_object_from_value (capability);
/* 1. */
while (true)
@ -290,7 +289,6 @@ ecma_builtin_promise_all_handler (const ecma_value_t function, /**< the function
argv[0],
false);
/* 9-10. */
ecma_value_t ret = ECMA_VALUE_UNDEFINED;
if (ecma_builtin_promise_remaining_inc_or_dec (remaining, false) == 0)

View File

@ -77,7 +77,6 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**<
JERRY_ASSERT (ecma_is_value_string (iterated_value));
ecma_string_t *string_p = ecma_get_string_from_value (iterated_value);
/* 6. */

View File

@ -715,7 +715,6 @@ ecma_builtin_string_prototype_object_slice (ecma_string_t *get_string_val, /**<
return ecma_make_string_value (new_str_p);
} /* ecma_builtin_string_prototype_object_slice */
/**
* The String.prototype object's 'split' routine
*

View File

@ -362,7 +362,6 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY,
float64array)
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
BUILTIN (ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE,
ECMA_OBJECT_TYPE_GENERAL,
ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,

View File

@ -332,7 +332,6 @@ ecma_builtin_typedarray_prototype_for_each (ecma_value_t this_arg, /**< this arg
TYPEDARRAY_ROUTINE_FOREACH);
} /* ecma_builtin_typedarray_prototype_for_each */
#if ENABLED (JERRY_ES2015)
/**
@ -1743,7 +1742,6 @@ ecma_builtin_typedarray_prototype_index_of (ecma_value_t this_arg, /**< this arg
: (uint32_t) (info.length + num_var));
}
ecma_number_t search_num = ecma_get_number_from_value (args[0]);
ecma_typedarray_getter_fn_t getter_cb = ecma_get_typedarray_getter_fn (info.id);

View File

@ -737,7 +737,6 @@ ecma_op_array_species_create (ecma_object_t *original_array_p, /**< The object f
&len_val,
1);
ecma_deref_object (ctor_object_p);
ecma_free_value (len_val);
return ret_val;

View File

@ -25,7 +25,6 @@
* @{
*/
/**
* Maximum number of new array holes in a fast mode access array.
* If the number of new holes exceeds this limit, the array is converted back

View File

@ -92,7 +92,6 @@ ecma_arraybuffer_new_object_external (ecma_length_t length, /**< length of the b
return object_p;
} /* ecma_arraybuffer_new_object_external */
/**
* ArrayBuffer object creation operation.
*

View File

@ -201,7 +201,6 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l
ecma_deref_object (next_object_p);
}
if (ECMA_IS_VALUE_ERROR (result))
{
ecma_op_iterator_close (iter);
@ -678,7 +677,6 @@ ecma_op_container_delete (ecma_value_t this_arg, /**< this argument */
return ECMA_VALUE_FALSE;
}
ecma_named_data_property_assign_value ((ecma_object_t *) container_p,
ECMA_PROPERTY_VALUE_PTR (property_p),
ECMA_VALUE_EMPTY);

View File

@ -681,7 +681,6 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
return result;
} /* ecma_op_function_has_instance */
#if ENABLED (JERRY_ES2015)
/**
* Indicates whether the class has been invoked with 'new'.

View File

@ -289,7 +289,6 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
&& ecma_is_lexical_environment (lex_env_p));
JERRY_ASSERT (name_p != NULL);
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
{
ecma_property_t *prop_p = ecma_find_named_property (lex_env_p, name_p);

View File

@ -418,7 +418,6 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
JERRY_ASSERT (property_desc_type == ECMA_PROPERTY_TYPE_GENERIC
|| property_desc_type == ECMA_PROPERTY_TYPE_NAMEDDATA);
ecma_property_value_t *new_prop_value_p = ecma_create_named_data_property (object_p,
property_name_p,
prop_attributes,

View File

@ -165,7 +165,6 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
return ECMA_PROPERTY_TYPE_NOT_FOUND;
}
break;
}
#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY)
@ -2339,7 +2338,6 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
JMEM_FINALIZE_LOCAL_ARRAY (names_p);
if (!is_with_prototype_chain || prototype_chain_iter_p->u2.prototype_cp == JMEM_CP_NULL)
{
break;

View File

@ -34,7 +34,6 @@ ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p,
ecma_collection_t *main_collection_p,
ecma_collection_t *non_enum_collection_p);
/**
* @}
* @}

View File

@ -123,7 +123,6 @@ ecma_typedarray_get_double_element (lit_utf8_byte_t *src) /**< the location in t
return (ecma_number_t) num;
} /* ecma_typedarray_get_double_element */
/**
* Normalize the given ecma_number_t to an uint32_t value
*/
@ -169,7 +168,6 @@ ecma_typedarray_set_int8_element (lit_utf8_byte_t *dst_p, /**< the location in t
*dst_p = (lit_utf8_byte_t) num;
} /* ecma_typedarray_set_int8_element */
/**
* Write an uint8_t value into the given arraybuffer
*/
@ -223,7 +221,6 @@ ecma_typedarray_set_int16_element (lit_utf8_byte_t *dst_p, /**< the location in
memcpy (dst_p, &num, sizeof (int16_t));
} /* ecma_typedarray_set_int16_element */
/**
* Write an uint8_t value into the given arraybuffer
*/
@ -246,7 +243,6 @@ ecma_typedarray_set_int32_element (lit_utf8_byte_t *dst_p, /**< the location in
memcpy (dst_p, &num, sizeof (int32_t));
} /* ecma_typedarray_set_int32_element */
/**
* Write an uint32_t value into the given arraybuffer
*/
@ -258,7 +254,6 @@ ecma_typedarray_set_uint32_element (lit_utf8_byte_t *dst_p, /**< the location in
memcpy (dst_p, &num, sizeof (uint32_t));
} /* ecma_typedarray_set_uint32_element */
/**
* Write a float value into the given arraybuffer
*/
@ -283,7 +278,6 @@ ecma_typedarray_set_double_element (lit_utf8_byte_t *dst_p, /**< the location in
} /* ecma_typedarray_set_double_element */
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
/**
* Builtin id of the first %TypedArray% builtin routine intrinsic object
*/
@ -666,7 +660,6 @@ ecma_typedarray_create_object_with_typedarray (ecma_object_t *typedarray_p, /**<
ecma_typedarray_getter_fn_t src_typedarray_getter_cb = ecma_get_typedarray_getter_fn (src_id);
ecma_typedarray_setter_fn_t target_typedarray_setter_cb = ecma_get_typedarray_setter_fn (typedarray_id);
for (uint32_t i = 0; i < array_length; i++)
{
/* Convert values from source to destination format. */
@ -839,7 +832,6 @@ ecma_typedarray_get_element_size_shift (ecma_object_t *typedarray_p) /**< the po
return ecma_typedarray_helper_get_shift_size (ecma_get_typedarray_id (typedarray_p));
} /* ecma_typedarray_get_element_size_shift */
/**
* Get the array length of the typedarray object
*

View File

@ -666,7 +666,6 @@ typedef enum
JERRY_TYPEDARRAY_FLOAT64,
} jerry_typedarray_type_t;
bool jerry_value_is_typedarray (jerry_value_t value);
jerry_value_t jerry_create_typedarray (jerry_typedarray_type_t type_name, jerry_length_t length);
jerry_value_t jerry_create_typedarray_for_arraybuffer_sz (jerry_typedarray_type_t type_name,

View File

@ -231,4 +231,3 @@ jmem_decompress_pointer (uintptr_t compressed_pointer) /**< pointer to decompres
return (void *) uint_ptr;
} /* jmem_decompress_pointer */

View File

@ -409,7 +409,6 @@ jmem_heap_insert_block (jmem_heap_free_t *block_p, /**< block to insert */
JMEM_VALGRIND_DEFINED_SPACE (block_p, sizeof (jmem_heap_free_t));
JMEM_VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t));
const uint32_t block_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (block_p);
/* Update prev. */

View File

@ -16,7 +16,6 @@
/* This file is automatically generated by the gen-magic-strings.py script
* from lit-magic-strings.ini. Do not edit! */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING__EMPTY, "")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPACE_CHAR, " ")
#if ENABLED (JERRY_ES2015)

View File

@ -2692,7 +2692,6 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
pattern_str_p = ecma_new_ecma_string_from_utf8_converted_to_cesu8 (regex_start_p, length);
}
completion_value = re_compile_bytecode (&re_bytecode_p,
pattern_str_p,
current_flags);

View File

@ -1,4 +1,3 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -17,7 +17,6 @@
#include "jerryscript-ext/arg.h"
#include "jerryscript.h"
#define JERRYX_STATIC_ASSERT(x, msg) \
enum { static_assertion_failed_ ## msg = 1 / (!!(x)) }

View File

@ -67,7 +67,6 @@ struct jerryx_handle_scope_s
JERRYX_HANDLE_SCOPE_FIELDS; /**< common handle scope fields */
};
typedef struct jerryx_handle_scope_dynamic_s jerryx_handle_scope_dynamic_t;
/**
* Dynamically allocated handle scope type.

View File

@ -208,7 +208,6 @@ jerryx_module_resolver_t jerryx_module_native_resolver =
.resolve_p = jerryx_resolve_native_module
};
static void
jerryx_module_resolve_local (const jerry_value_t name, /**< name of the module to load */
const jerryx_module_resolver_t **resolvers_p, /**< list of resolvers */

View File

@ -30,7 +30,6 @@
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
but these catch some common cases. */
#ifndef __LITTLE_ENDIAN
/* Check if compiler has byte order macro. Some older versions do not.
* If byte order is supported and set to little or target is among common

View File

@ -275,7 +275,6 @@ A. sqrt(x) by Newton Iteration
------------------------------------------------------
msb lsb msb lsb ...order
------------------------ ------------------------
x0: |s| e | f1 | x1: | f2 |
------------------------ ------------------------
@ -307,7 +306,6 @@ A. sqrt(x) by Newton Iteration
y := (y+x/y)/2 ... almost 35 sig. bits
y := y-(y-x/y)/2 ... within 1 ulp
Remark 1.
Another way to improve y to within 1 ulp is:
@ -320,7 +318,6 @@ A. sqrt(x) by Newton Iteration
2
3y + x
This formula has one division fewer than the one above; however,
it requires more multiplications and additions. Also x must be
scaled in advance to avoid spurious overflow in evaluating the
@ -367,7 +364,6 @@ A. sqrt(x) by Newton Iteration
Square root of +inf, +-0, or NaN is itself;
Square root of a negative number is NaN with invalid signal.
B. sqrt(x) by Reciproot Iteration
(1) Initial approximation

View File

@ -50,7 +50,6 @@ int gettimeofday (struct timeval *tv,
} /* gettimeofday */
#endif /* __GNUC__ */
int rand (void);
/**

View File

@ -17,7 +17,6 @@
#include "jerryscript.h"
int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
{
srand (0);

View File

@ -274,7 +274,6 @@ register_js_function (const char *name_p, /**< name of the function */
jerry_release_value (result_val);
} /* register_js_function */
/**
* Runs the source code received by jerry_debugger_wait_for_client_source.
*
@ -304,7 +303,6 @@ wait_for_source_callback (const jerry_char_t *resource_name_p, /**< resource nam
return ret_val;
} /* wait_for_source_callback */
/**
* Command line option IDs
*/

View File

@ -41,7 +41,6 @@ void UnixTimeToFileTime (LONGLONG t, LPFILETIME pft)
} /* UnixTimeToFileTime */
#endif /* _WINDOWS */
/**
* Default implementation of jerry_port_get_local_time_zone_adjustment. Uses the 'tm_gmtoff' field
* of 'struct tm' (a GNU extension) filled by 'localtime_r' if available on the

View File

@ -40,7 +40,6 @@ typedef struct
jerry_value_t expected;
} test_entry_t;
typedef struct
{
jerry_binary_operation_t op;
@ -191,7 +190,6 @@ main (void)
T (JERRY_BIN_OP_SUB, jerry_create_boolean (false), jerry_create_boolean (false), jerry_create_number (0.0)),
T (JERRY_BIN_OP_SUB, jerry_create_null (), jerry_create_null (), jerry_create_number (-0.0)),
/* Testing multiplication (*) */
T (JERRY_BIN_OP_MUL, jerry_create_number (5.0), jerry_create_number (5.0), jerry_create_number (25.0)),
T (JERRY_BIN_OP_MUL, jerry_create_number (3.1), jerry_create_number (10), jerry_create_number (31)),

View File

@ -119,7 +119,6 @@ handler_construct_2_freecb (void *native_p)
test_api_is_free_callback_was_called = true;
} /* handler_construct_2_freecb */
/**
* The name of the jerry_object_native_info_t struct.
*/
@ -271,8 +270,6 @@ foreach (const jerry_value_t name, /**< field name */
TEST_ASSERT (false);
return false;
} /* foreach */
static bool

View File

@ -113,7 +113,6 @@ test_context_data4_new (void *user_data_p)
TEST_ASSERT (user_data_p == NULL);
} /* test_context_data4_new */
static void
test_context_data4_free (void *user_data_p)
{
@ -138,7 +137,6 @@ static const jerry_context_data_manager_t manager4 =
.bytes_needed = 0
};
int
main (void)
{

View File

@ -16,7 +16,6 @@
#include "jerryscript.h"
#include "test-common.h"
int main (void)
{
if (!jerry_is_feature_enabled (JERRY_FEATURE_MEM_STATS))

View File

@ -13,7 +13,6 @@
* limitations under the License.
*/
#include "jerryscript.h"
#include "jerryscript-port.h"
#include "jerryscript-port-default.h"

View File

@ -18,7 +18,6 @@
#include "jerryscript-port-default.h"
#include "test-common.h"
static const jerry_char_t test_source[] = TEST_STRING_LITERAL (
"var p1 = create_promise1();"
"var p2 = create_promise2();"

View File

@ -100,7 +100,6 @@ main (void)
"f2(); \n");
const char *resource_2 = "demo2.js";
program = jerry_parse ((const jerry_char_t *) resource_2,
strlen (resource_2),
(const jerry_char_t *) source_2,

View File

@ -155,7 +155,6 @@ main (void)
}
ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);
ecma_string_t *expected_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
for (size_t i = 0; i < count; i++)
{

View File

@ -130,5 +130,3 @@ main (void)
return 0;
} /* main */

View File

@ -401,7 +401,6 @@ test_validator_prop2_handler (const jerry_value_t func_obj_val, /**< function ob
jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));
TEST_ASSERT (!jerry_value_is_error (is_ok));
if (validator_prop_count == 1)
@ -622,7 +621,6 @@ test_validator_array1_handler (const jerry_value_t func_obj_val, /**< function o
jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));
TEST_ASSERT (!jerry_value_is_error (is_ok));
if (validator_array_count == 0)

View File

@ -185,7 +185,6 @@ test_error_setvalue (void)
jerry_cleanup ();
} /* test_error_setvalue */
/**
* Test registration error with jerryx_set_properties.
*

View File

@ -221,8 +221,6 @@ def generate_header(gen_file):
def generate_magic_string_defs(gen_file, defs):
print(file=gen_file) # empty line separator
last_guards = set([()])
for str_ref, str_value, guards in defs:
if last_guards != guards:

View File

@ -11,6 +11,8 @@ set rules {
jerry_no_space_before_closing_parentheses
jerry_no_tabs
jerry_no_trailing_spaces
jerry_no_leading_or_trailing_empty_line
jerry_no_consecutive_empty_lines
jerry_pointer_declarator_space
jerry_switch_case
jerry_typecast_space_parentheses

View File

@ -0,0 +1,36 @@
#!/usr/bin/tclsh
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set maxEmptyLines 1
foreach f [getSourceFileNames] {
set lineNumber 1
set emptyCount 0
set reported false
foreach line [getAllLines $f] {
if {[string trim $line] == ""} {
incr emptyCount
if {$emptyCount > $maxEmptyLines && $reported == "false"} {
report $f $lineNumber "too many consecutive empty lines"
set reported true
}
} else {
set emptyCount 0
set reported false
}
incr lineNumber
}
}

View File

@ -0,0 +1,30 @@
#!/usr/bin/tclsh
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
foreach f [getSourceFileNames] {
set lineCount [getLineCount $f]
if {$lineCount > 0} {
set firstLine [getLine $f 1]
if {[string trim $firstLine] == ""} {
report $f 1 "leading empty line(s)"
}
set lastLine [getLine $f $lineCount]
if {[string trim $lastLine] == ""} {
report $f $lineCount "trailing empty line(s)"
}
}
}