Skip to content
Merged
13 changes: 13 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Checks: >
-*,
bugprone-*,
modernize-*,
readability-*,
performance-*,
-modernize-use-trailing-return-type,
-readability-magic-numbers,
-readability-identifier-length,
-bugprone-easily-swappable-parameters

HeaderFilterRegex: '(include|src)/.*\.h$'
WarningsAsErrors: ''
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ Before running it, export `DEVICE_SSH_USER`, `DEVICE_SSH_HOST`, and `DEVICE_SSH_

## Lint

Use `lint.sh` to run local static analysis for C/C++ sources.
Use `lint.sh` to run the same clang-format lint that CI enforces.
It checks tracked `*.cpp` and `*.h` files using:

- `git ls-files -- '*.cpp' '*.h' | xargs clang-format --dry-run --Werror`

Examples:

- `./lint.sh`
- `./lint.sh --tidy-only`
- `./lint.sh --tidy-only --fix`
- `./lint.sh --cppcheck-only`
- `./lint.sh --fix`
- `./lint.sh --local`
- `SKIP_DOCKER=1 ./lint.sh`

## Coverity

Expand Down
8 changes: 4 additions & 4 deletions include/firebolt/accessibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class IAccessibility
*
* @retval The audio description setting state or error
*/
virtual Result<bool> audioDescription() const = 0;
[[nodiscard]] virtual Result<bool> audioDescription() const = 0;

/**
* @brief Subscribe to audio description setting changes
Expand All @@ -63,7 +63,7 @@ class IAccessibility
*
* @retval ClosedCaptionsSettings or error
*/
virtual Result<ClosedCaptionsSettings> closedCaptionsSettings() const = 0;
[[nodiscard]] virtual Result<ClosedCaptionsSettings> closedCaptionsSettings() const = 0;

virtual Result<SubscriptionId>
subscribeOnClosedCaptionsSettingsChanged(std::function<void(const ClosedCaptionsSettings&)>&& notification) = 0;
Expand All @@ -73,15 +73,15 @@ class IAccessibility
*
* @retval The high contrast UI setting or error
*/
virtual Result<bool> highContrastUI() const = 0;
[[nodiscard]] virtual Result<bool> highContrastUI() const = 0;

virtual Result<SubscriptionId> subscribeOnHighContrastUIChanged(std::function<void(bool)>&& notification) = 0;

/**
* @brief Returns voice guidance settings: enabled, rate, and verbosity
* @retval VoiceGuidanceSettings or error
*/
virtual Result<VoiceGuidanceSettings> voiceGuidanceSettings() const = 0;
[[nodiscard]] virtual Result<VoiceGuidanceSettings> voiceGuidanceSettings() const = 0;

virtual Result<SubscriptionId>
subscribeOnVoiceGuidanceSettingsChanged(std::function<void(const VoiceGuidanceSettings&)>&& notification) = 0;
Expand Down
5 changes: 3 additions & 2 deletions include/firebolt/actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class IActions
public:
virtual ~IActions() = default;

virtual Result<Intent> intent() const = 0;
[[nodiscard]] virtual Result<Intent> intent() const = 0;

virtual Result<SubscriptionId> subscribeOnIntent(std::function<void(const Intent&)>&& notification) = 0;
virtual Result<SubscriptionId> subscribeOnIntentChanged(std::function<void(const Intent&)>&& notification)
Expand All @@ -64,7 +64,8 @@ class IActions
virtual Result<void> unsubscribe(SubscriptionId id) = 0;
virtual void unsubscribeAll() = 0;

virtual Result<void> start(const IntentData& intent, std::optional<std::string> handlerAppId = std::nullopt) const = 0;
[[nodiscard]] virtual Result<void> start(const IntentData& intent,
std::optional<std::string> handlerAppId = std::nullopt) const = 0;

}; // class IActions

Expand Down
2 changes: 1 addition & 1 deletion include/firebolt/advertising.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ class IAdvertising
* @return Ifa struct or error
*
*/
virtual Result<Ifa> advertisingId() const = 0;
[[nodiscard]] virtual Result<Ifa> advertisingId() const = 0;
};
} // namespace Firebolt::Advertising
14 changes: 7 additions & 7 deletions include/firebolt/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,42 +58,42 @@ class IDevice
*
* @retval The chipset id string or error
*/
virtual Result<std::string> chipsetId() const = 0;
[[nodiscard]] virtual Result<std::string> chipsetId() const = 0;

/**
* @brief Get the class of the device
*
* @retval The class property or error
*/
virtual Result<DeviceClass> deviceClass() const = 0;
[[nodiscard]] virtual Result<DeviceClass> deviceClass() const = 0;

/**
* @brief Returns the HDR standards that are supported by the attached TV or the integral display
*
* @retval The HDR format capabilities or error
*/
virtual Result<HDRFormat> hdr() const = 0;
[[nodiscard]] virtual Result<HDRFormat> hdr() const = 0;

/**
* @brief Returns number of seconds since most recent device boot, including any time spent during deep sleep
*
* @retval The uptime in seconds or error
*/
virtual Result<uint32_t> timeInActiveState() const = 0;
[[nodiscard]] virtual Result<uint32_t> timeInActiveState() const = 0;

/**
* @brief Returns a persistent unique UUID for the current app and device. The UUID is reset when the app or device is reset
*
* @retval The uid string or error
*/
virtual Result<std::string> uid() const = 0;
[[nodiscard]] virtual Result<std::string> uid() const = 0;

/**
* @brief Returns number of seconds since most recent device boot, including any time spent during deep sleep
*
* @retval The uptime in seconds or error
*/
virtual Result<uint32_t> uptime() const = 0;
[[nodiscard]] virtual Result<uint32_t> uptime() const = 0;

/**
* @brief Subscribe to HDR format changes
Expand Down Expand Up @@ -122,7 +122,7 @@ class IDevice
*
* @retval True if Dolby Atmos experience is available, or error
*/
virtual Result<bool> dolbyAtmosExperienceAvailable() const = 0;
[[nodiscard]] virtual Result<bool> dolbyAtmosExperienceAvailable() const = 0;

/**
* @brief Subscribe to Dolby Atmos experience availability changes
Expand Down
12 changes: 6 additions & 6 deletions include/firebolt/discovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class IDiscovery
* Prefer watchedV2() for new integrations, which returns Result<void> and omits the
* redundant boolean payload.
*/
virtual Result<bool> watched(const std::string& entityId, std::optional<double> progress,
std::optional<bool> completed, std::optional<std::string> watchedOn,
std::optional<Firebolt::AgePolicy> agePolicy) const = 0;
[[nodiscard]] virtual Result<bool> watched(const std::string& entityId, std::optional<double> progress,
std::optional<bool> completed, std::optional<std::string> watchedOn,
std::optional<Firebolt::AgePolicy> agePolicy) const = 0;

/**
* @brief Notify the platform that content was partially or completely watched
Expand All @@ -62,8 +62,8 @@ class IDiscovery
*
* @retval An ok Result on success, or an error; no value is returned
*/
virtual Result<void> watchedV2(const std::string& entityId, std::optional<double> progress,
std::optional<bool> completed, std::optional<std::string> watchedOn,
std::optional<Firebolt::AgePolicy> agePolicy) const = 0;
[[nodiscard]] virtual Result<void> watchedV2(const std::string& entityId, std::optional<double> progress,
std::optional<bool> completed, std::optional<std::string> watchedOn,
std::optional<Firebolt::AgePolicy> agePolicy) const = 0;
};
} // namespace Firebolt::Discovery
6 changes: 3 additions & 3 deletions include/firebolt/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IDisplay
*
* @retval The class property or error
*/
virtual Result<std::string> edid() const = 0;
[[nodiscard]] virtual Result<std::string> edid() const = 0;

/**
* @brief Returns the physical/native resolution of the connected or integral display, in pixels
Expand All @@ -56,7 +56,7 @@ class IDisplay
*
* @retval The display resolution (width and height in pixels) or error
*/
virtual Result<DisplaySize> maxResolution() const = 0;
[[nodiscard]] virtual Result<DisplaySize> maxResolution() const = 0;

/**
* @brief Returns the physical dimensions of the connected or integral display, in centimeters
Expand All @@ -71,7 +71,7 @@ class IDisplay
*
* @retval The class property or error
*/
virtual Result<DisplaySize> size() const = 0;
[[nodiscard]] virtual Result<DisplaySize> size() const = 0;
};

} // namespace Firebolt::Display
3 changes: 3 additions & 0 deletions include/firebolt/firebolt.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "firebolt/presentation.h"
#include "firebolt/stats.h"
#include "firebolt/texttospeech.h"
#include "firebolt/videooutput.h"
#include <firebolt/config.h>
#include <firebolt/types.h>
#include <functional>
Expand Down Expand Up @@ -169,5 +170,7 @@ class FIREBOLTCLIENT_EXPORT IFireboltAccessor
* @return Reference to Actions interface
*/
virtual Actions::IActions& ActionsInterface() = 0;

virtual VideoOutput::IVideoOutput& VideoOutputInterface() = 0;
};
} // namespace Firebolt
4 changes: 2 additions & 2 deletions include/firebolt/lifecycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ class ILifecycle
*
* @param[in] type The type of the close app is requesting
*/
virtual Result<void> close(const CloseType& type) const = 0;
[[nodiscard]] virtual Result<void> close(const CloseType& type) const = 0;

/**
* @brief Get the current lifecycle state of the app
*
* @retval The current lifecycle state or error
*/
virtual Result<LifecycleState> state() const = 0;
[[nodiscard]] virtual Result<LifecycleState> state() const = 0;

/**
* @brief Subscribe to lifecycle state changes
Expand Down
8 changes: 4 additions & 4 deletions include/firebolt/localization.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,29 @@ class ILocalization
*
* @retval The device country code or error
*/
virtual Result<std::string> country() const = 0;
[[nodiscard]] virtual Result<std::string> country() const = 0;

/**
* @brief A list of zero or more languages in order of decreasing preference. Typically two languages are present.
* A language may be repeated in the list
*
* @retval The preferred audio languages or error
*/
virtual Result<std::vector<std::string>> preferredAudioLanguages() const = 0;
[[nodiscard]] virtual Result<std::vector<std::string>> preferredAudioLanguages() const = 0;

/**
* @brief The presentation language of the device, in BCP 47, e.g. en-US
*
* @retval The preferred audio languages or error
*/
virtual Result<std::string> presentationLanguage() const = 0;
[[nodiscard]] virtual Result<std::string> presentationLanguage() const = 0;

/**
* @brief Get the IANA timezone of the device.
*
* @retval The device timezone or error
*/
virtual Result<std::string> timeZone() const = 0;
[[nodiscard]] virtual Result<std::string> timeZone() const = 0;

/**
* @brief Subscribe on the change of CountryChanged property
Expand Down
Loading
Loading