Prepere repo so we can run auto formatters (#747)

* clang-format: Ignore javascript files

Ignore javascript files. Clang-format is not very good formatter for
javascript files anyway. If we ever need javascript formatter we should
use Prettier.

* clang-format: Ignore some lines in sources

Couple things get formatted really funky if we let clang-format format
those. Just ignore those locally.

* zephyr/tescase.yaml: Fix yaml syntax

pre-commit hook check-yaml did found out that there are two skips.
Remove another as this is not right syntax.

* Fix repo contains unicode replacement chars

When running pre-commit text-unicode-replacement-char it founds that
there is couple unicode replacemnt chars. Remove and replace these.

* Convert some tabs to spaces manually

We will soon auto format tabs to spaces. How ever it could not do couple
thing so fix those by hand first.

* Make files with shebang executables

It is good habit that if file has shebang then it is marked executable.
These where found with pre-commit check-shebang-scripts-are-executable
checker.

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander
2024-08-24 01:58:41 +03:00
committed by GitHub
parent 36b5a3be98
commit 9e0657424e
26 changed files with 84 additions and 77 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ BACNET_ADDRESS *Get_Routed_Device_Address(int idx)
* devices with routing.
*
* @param my_address [out] Points to the currently active Device Object's
* BACnet address.
* BACnet address.
*/
void routed_get_my_address(BACNET_ADDRESS *my_address)
{
+2 -2
View File
@@ -198,10 +198,10 @@ extern "C" {
BACNET_STACK_EXPORT
bool Network_Port_IP_DHCP_Enable(
uint32_t object_instance);
uint32_t object_instance);
BACNET_STACK_EXPORT
bool Network_Port_IP_DHCP_Enable_Set(
uint32_t object_instance, bool value);
uint32_t object_instance, bool value);
BACNET_STACK_EXPORT
bool Network_Port_IP_DNS_Server(
+1 -1
View File
@@ -222,7 +222,7 @@ int PositiveInteger_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
apdu_len =
encode_application_enumerated(&apdu[0], CurrentAV->Units);
break;
/* BACnet Testing Observed Incident oi00109
/* BACnet Testing Observed Incident oi00109
Positive Integer Value / Units returned wrong datatype -
missing break. Revealed by BACnet Test Client v1.8.16 (
www.bac-test.com/bacnet-test-client-download ) BITS: BIT00031 BC
+2
View File
@@ -19,12 +19,14 @@
* @{
*/
#ifndef NEXT_POWER_OF_2
/* clang-format off */
#define B2(x) ( (x) | ( (x) >> 1) )
#define B4(x) ( B2(x) | ( B2(x) >> 2) )
#define B8(x) ( B4(x) | ( B4(x) >> 4) )
#define B16(x) ( B8(x) | ( B8(x) >> 8) )
#define B32(x) (B16(x) | (B16(x) >>16) )
#define NEXT_POWER_OF_2(x) (B32((x)-1) + 1)
/* clang-format on */
#endif
/** @} */
+6 -1
View File
@@ -130,7 +130,9 @@
/* BACAPP decodes WriteProperty service requests
Choose the datatypes that your application supports */
#if !(defined(BACAPP_ALL) || \
/* clang-format off */
#if !( \
defined(BACAPP_ALL) || \
defined(BACAPP_MINIMAL) || \
defined(BACAPP_NULL) || \
defined(BACAPP_BOOLEAN) || \
@@ -166,6 +168,7 @@
defined(BACAPP_TYPES_EXTRA))
#define BACAPP_ALL
#endif
/* clang-format on */
#if defined (BACAPP_ALL)
#define BACAPP_MINIMAL
@@ -210,6 +213,7 @@
#define BACAPP_SHED_LEVEL
#endif
/* clang-format off */
#if defined(BACAPP_DOUBLE) || \
defined(BACAPP_DATETIME) || \
defined(BACAPP_DATERANGE) || \
@@ -231,6 +235,7 @@
defined(BACAPP_SHED_LEVEL)
#define BACAPP_COMPLEX_TYPES
#endif
/* clang-format on */
/*
** Set the maximum vector type sizes
+7 -7
View File
@@ -1465,9 +1465,9 @@ int bvlc6_decode_secure_bvll(uint8_t *pdu,
*
* This message provides a mechanism whereby a foreign device
* shall cause a BBMD to distribute a Forwarded-NPDU
* BVLC to the local multicast domain, to all BBMDs configured
* in the BBMDs BDT, and to all foreign devices in the
* BBMDs FDT.
* BVLC to the local multicast domain, to all BBMD's configured
* in the BBMD's BDT, and to all foreign devices in the
* BBMD's FDT.
*
* @param pdu - buffer to store the encoding
* @param pdu_size - size of the buffer to store encoding
@@ -1696,10 +1696,10 @@ int bvlc6_broadcast_distribution_table_encode(uint8_t *apdu,
{
int len = 0;
len = bvlc6_broadcast_distribution_table_list_encode(NULL,
len = bvlc6_broadcast_distribution_table_list_encode(NULL,
bdt_head);
if (len <= apdu_size) {
len = bvlc6_broadcast_distribution_table_list_encode(apdu,
len = bvlc6_broadcast_distribution_table_list_encode(apdu,
bdt_head);
} else {
len = BACNET_STATUS_ERROR;
@@ -1800,10 +1800,10 @@ int bvlc6_foreign_device_table_encode(uint8_t *apdu,
{
int len = 0;
len = bvlc6_foreign_device_table_list_encode(NULL,
len = bvlc6_foreign_device_table_list_encode(NULL,
fdt_head);
if (len <= apdu_size) {
len = bvlc6_foreign_device_table_list_encode(apdu,
len = bvlc6_foreign_device_table_list_encode(apdu,
fdt_head);
} else {
len = BACNET_STATUS_ERROR;
+4 -4
View File
@@ -152,8 +152,8 @@ static bool MSTP_Compare_Data_Expecting_Reply(
request.address.mac[0] = src_address;
request.address.mac_len = 1;
offset = bacnet_npdu_decode(
&request_pdu[0], request_pdu_len, NULL, &request.address,
&request.npdu_data);
&request_pdu[0], request_pdu_len, NULL, &request.address,
&request.npdu_data);
if (request.npdu_data.network_layer_message) {
return false;
}
@@ -170,8 +170,8 @@ static bool MSTP_Compare_Data_Expecting_Reply(
/* decode the reply data */
bacnet_address_copy(&reply.address, dest_address);
offset = bacnet_npdu_decode(
&reply_pdu[0], reply_pdu_len, &reply.address, NULL,
&reply.npdu_data);
&reply_pdu[0], reply_pdu_len, &reply.address, NULL,
&reply.npdu_data);
if (reply.npdu_data.network_layer_message) {
return false;
}
+1 -1
View File
@@ -393,7 +393,7 @@ int rr_decode_service_request(
* ReadRange-ACK ::= SEQUENCE {
* objectIdentifier [0] BACnetObjectIdentifier,
* propertyIdentifier [1] BACnetPropertyIdentifier,
* propertyArrayIndex [2] Unsigned OPTIONAL , -- used only with
* propertyArrayIndex [2] Unsigned OPTIONAL, -- used only with
* array datatype resultFlags [3] BACnetResultFlags, itemCount [4]
* Unsigned, itemData [5] SEQUENCE OF ABSTRACT-SYNTAX.&TYPE,
* firstSequenceNumber [6] Unsigned32 OPTIONAL -- used only if 'Item